comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Does TRIANGULATE return vertices in counter-clockwise order?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Does TRIANGULATE return vertices in counter-clockwise order? [message #10602] Wed, 07 January 1998 00:00
Andrea Spinelli is currently offline  Andrea Spinelli
Messages: 4
Registered: August 1996
Junior Member
Hi everybody!

I am using IDL's TRIANGULATE to generate triangulations (what else?) for
surfaces having an 'upper' and a 'lower' side. I would
be happy to be sure that the triangle vertices are listed in
counter-clockwise order, which may be expressed like that:

triangulate, x, y, tri
for i=0,(size(tri))[2] do begin
ia = tri[0,i]
ib = tri[1,i]
ic = tri[2,i]
a = [x[va],y[va]]
b = [x[vb],y[vb]]
c = [x[vc],y[vc]]

nz = (b-a)[0]*(c-a)[1] - (b-a)[1]*(c-a)[0]

if nz LT 0 then message, 'failure!'
; nz is the z component of the normal to the triangle
; the question is:
; is (nz GE 0) _ALWAYS_ true ????
endfor

I tried with 5000 uniform random points, and had no failure, but who
knows better??
Even if the current IDL implementation supports CCW ordering, maybe the
next will not.
Of course, I can triangulate and then rearrange the vertices (which is
what I currently do), but it is inefficient and inelegant.

The documentation does not state anything useful (do not be fooled by
the optional param
B! B's vertices are guaranteed to be in CCW order, but not Triangles'
vertices).

Andrea
----
Andrea Spinelli, aspinelli@ismes.it
+39-35-307209 phone
+39-35-302999 fax
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: how to add mark for every points in each plot?
Next Topic: problem with arrays of structures

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:14:03 PDT 2025

Total time taken to generate the page: 0.00521 seconds