📄 gmviz_matlabplot.m
字号:
function gmviz_matlabplot(handle1, bbox, coords, simps, colors, vizdim, thickness)
axes(handle1);
hold on
[sz1,sz2] = size(simps);
simps = simps + ones(sz1,sz2);
if vizdim == 0
if thickness(1) > 1
pltstr = 'ow';
else
pltstr = '.w';
end
[m,n] = size(coords);
if (n == 2)
for i = 1 : m
if colors(i,4) > 0
h = plot(coords(i,1), coords(i,2),pltstr);
set(h,'color', colors(i,1:3))
end
end
else
for i = 1 : m
if colors(i,4) > 0
h = plot3(coords(i,1), coords(i,2), coords(i,3), pltstr);
set(h,'color', colors(i,1:3))
end
end
end
elseif vizdim == 1
[scrap,di] = size(coords);
if di == 2
h1 = plot([coords(simps(:,1),1)';coords(simps(:,2),1)'], ...
[coords(simps(:,1),2)';coords(simps(:,2),2)'], ...
'-k');
else
h1 = plot3([coords(simps(:,1),1)';coords(simps(:,2),1)'], ...
[coords(simps(:,1),2)';coords(simps(:,2),2)'], ...
[coords(simps(:,1),3)';coords(simps(:,2),3)'], ...
'-k');
end
[m,scrap] = size(simps);
for i = 1 : m
if colors(i,4) > 0
set(h1(i), 'color', colors(i,1:3));
if (thickness(2) > 0)
set(h1(i),'linewidth', thickness(2) / 50);
end
else
delete(h1(i));
end
end
else
[scrap,di] = size(coords);
[m,scrap] = size(simps);
if di == 2
for i = 1 : m
if (colors(i,4) > 0)
h = fill(...
[coords(simps(i,1),1),coords(simps(i,2),1),coords(simps(i,3),1)],...
[coords(simps(i,1),2),coords(simps(i,2),2),coords(simps(i,3),2)],...
colors(i,1:3));
set(h,'EdgeColor', 'none');
end
end
else
for i = 1 : m
if (colors(i,4) > 0)
h = fill3(...
[coords(simps(i,1),1),coords(simps(i,2),1),coords(simps(i,3),1)],...
[coords(simps(i,1),2),coords(simps(i,2),2),coords(simps(i,3),2)],...
[coords(simps(i,1),3),coords(simps(i,2),3),coords(simps(i,3),3)],...
colors(i,1:3));
set(h,'EdgeColor', 'none');
set(h,'FaceLighting', 'phong');
end
end
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -