我需要在 matlab 中绘制一个 3D 线条列表。最快的方法是什么?
目前我正在进行类似以下的操作:
%edges is a MX2 matrix, holding the list of edges
%points are the vertices' coordinates
hold on; %so all the lines will be saved
for i=1:size(edges,1)
a=edges(i,1); %get first point's index
b=edges(i,2); %get second point's index
p=[points(:,a) points(:,b)]; %construct a 3X2 matrix out of the 2 points
plot3(p(1,:),p(2,:),p(3,:)); %plot a line
end
但是这不仅在实际循环过程中速度缓慢,而且在结束时,使用拖动和旋转工具旋转时,生成的图形非常缓慢和不响应。
我知道使用OpenGL等相同的绘图库可以更快地运行...