-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathplot_looplimit.m
More file actions
executable file
·59 lines (49 loc) · 1.93 KB
/
plot_looplimit.m
File metadata and controls
executable file
·59 lines (49 loc) · 1.93 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
function plot_looplimit(mesh, vertices, res, InteriorColor, EdgeColor)
% PLOT_LOOPLIMIT Draw the limit of a loop surface given by the MESHTRI
% mesh and the vertices
if nargin < 3
res = 2;
end
if nargin < 4
InteriorColor = [ 0.8 0.8 0.8 ];
end
if nargin < 5
EdgeColor = [ 1 0 0 ];
end
currcol = zeros(res + 1, 3);
for face = 1:length(mesh.edges) / 3;
for x = 0:res
for y = 0:x
limitpoint = mesh.limitevaluation(face, ...
(x - y) / res, y / res);
currcol(y + 1, :) = limitpoint * vertices;
end
if x > 0
l = [ prevcol(1, :) ; currcol(1, :) ];
line(l(:, 1), l(:, 2), l(:, 3), 'Color', EdgeColor);
l = [ prevcol(x, :) ; currcol(x + 1, :) ];
line(l(:, 1), l(:, 2), l(:, 3), 'Color', EdgeColor);
end
if ~all(InteriorColor == 1)
for yv = 1:x - 1
l = [ prevcol(yv + 1, :) ; currcol(yv + 1, :) ];
line(l(:, 1), l(:, 2), l(:, 3), 'Color', InteriorColor);
l = [ prevcol(yv, :) ; currcol(yv + 1, :) ];
line(l(:, 1), l(:, 2), l(:, 3), 'Color', InteriorColor);
end
end
if x < res
if ~all(InteriorColor == 1)
line(currcol(1:x + 1, 1), ...
currcol(1:x + 1, 2), currcol(1:x + 1, 3), ...
'Color', InteriorColor);
end
else
line(currcol(:, 1), currcol(:, 2), currcol(:, 3), ...
'Color', EdgeColor);
end
prevcol = currcol;
end
end
axis equal;
end