Hello, thanks for reading this,
What I do currently in some MATLAB code is plot3 a series of lines, defined by a beginning and end point. I have 3d coordinate info stored in a nx3 pt matrix, and the connectivity information stored in a mx2 matrix. The data can look something like:
ptMx = [-0.0004 0.0003 1.9039 -0.0004 0.0003 1.1424 -0.1502 0.0001 0.6856 0.1397 0.0004 0.6853]; faceMx = [1 2 2 3 2 4]
So point 1 is connected to point 2, 2 to 3, and 2 to 4. I plot these with the following code:
for i=1:size(faceMx,1) hold on plot3([ptMx(faceMx(i,1),1) ptMx(faceMx(i,2),1)], ... [ptMx(faceMx(i,1),2) ptMx(faceMx(i,2),2)], ... [ptMx(faceMx(i,1),3) ptMx(faceMx(i,2),3)]) end
So as you can see, I go through every element and hold on a plot3 line. My problem is this can take a very large amount of time, and it makes rotating/translating the plot very slow. Is there a better/faster way to draw a series of lines this way?
Thanks!
EDIT: I know I can switch plot3 to line to speed this up a little bit, I was hoping if there was a better way available. Sometimes, I can be plotting up to 50k lines, and during these times patches of surface meshes with triangle patches with a similar number is many times faster.
Best Answer