Skip to content
Prev 68330 / 398513 Next

ugly loop

Thanks Marc for your help.
This doesn't give the same results as my original code -- it scrambles the 
order.

OK I will explain my example.

pts contains the x, y, z coordinates of some 3D points. These points are 
the vertices of 3D triangles.

ver contains the indexes into pts.

each line of ver contains 3 vertices -- they are the corners of a 
triangle. For example, if line 1 of ver is
10 9 7
That means I need to draw a triangle whose coordinates are
pt$x[10],pt$y[10],pt$z[10]
pt$x[9],pt$y[9],pt$z[9]
pt$x[7],pt$y[7],pt$z[7]

Now it should be clear why the ordering is critical.
I am using rgl.triangles() to plot. It requires the x,y,z coordinates in 
the order I gave in my original code.

Cheers
Bill