-
Notifications
You must be signed in to change notification settings - Fork 0
/
displayShape.m
32 lines (30 loc) · 1002 Bytes
/
displayShape.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
% GITHUB FUNCTION - with minor adjustments
% This function plots the given shape, colored with annotations in case the
% annot input is indicated
function displayShape(shape,annot)
for k = 1:size(shape.triangles,1)
% Get the triangle coordinates
coord = [shape.points(shape.triangles(k,1),:) ;
shape.points(shape.triangles(k,2),:) ;
shape.points(shape.triangles(k,3),:)];
if nargin > 1
switch(annot{1}(k)) %added {1}
case '0'
col = 'k';
case '1'
col = 'm';
case '2'
col = 'g';
case '3'
col = 'r';
end
fill(coord(:,1),coord(:,2),col,'EdgeColor','None');
else
fill(coord(:,1),coord(:,2),'w','EdgeColor','Black');
end
hold on;
end
axis equal
axis off
hold off; % added to ensure creation of individual PNG files
end