-
Notifications
You must be signed in to change notification settings - Fork 0
/
Shape.m
37 lines (27 loc) · 1023 Bytes
/
Shape.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
classdef Shape
% METHODS
% - Shape() to construct Shape object
% - plotShape() to plot the shape with the center at position
properties
name
color
opacity
vertices
faces
end
methods
function obj = Shape(name, color, opacity)
obj.name = name;
obj.color = color;
obj.opacity = opacity;
end
function disp = plotShape(obj, position)
positionOfVertices = obj.vertices;
positionOfVertices(:,1) = positionOfVertices(:,1) + position(1);
positionOfVertices(:,2) = positionOfVertices(:,2) + position(2);
positionOfVertices(:,3) = positionOfVertices(:,3) + position(3);
disp = patch('Faces', obj.faces, 'Vertices', positionOfVertices, ...
'FaceColor', obj.color, 'FaceAlpha', obj.opacity);
end
end
end