 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Paul Nicholls Guest
|
Posted: Wed Apr 21, 2004 3:02 am Post subject: Sorting 3d triangle points around normal to be anticlockwise |
|
|
Hi all, I was wondering how I can sort the vertices of a 3d triangle
relative to a normal so they are anticlockwise around the normal?
I have tried googling, but no luck so far...
Thanks in advance,
Paul Nicholls (Delphi 5/6 Professional)
"See No Evil, Hear No Evil, EMail No Evil !" - Paul Nicholls
[email]paul-nicholls (AT) hotmail (DOT) com[/email]
Replace '-' with '_' to reply
|
|
| Back to top |
|
 |
Eric Grange Guest
|
Posted: Wed Apr 21, 2004 7:48 am Post subject: Re: Sorting 3d triangle points around normal to be anticlock |
|
|
| Quote: | Hi all, I was wondering how I can sort the vertices of a 3d triangle
relative to a normal so they are anticlockwise around the normal?
|
Compute the triangle's plane normal with a cross product, then compute
the dot product of that normal vs your reference normal, if the result
is negative, you have to invert the order of the vertices.
Eric
|
|
| Back to top |
|
 |
Paul Nicholls Guest
|
Posted: Thu Apr 22, 2004 12:21 am Post subject: Re: Sorting 3d triangle points around normal to be anticlock |
|
|
Thanks Eric, I came up with this myself last night! <G>
Thanks though :-)
Cheers,
Paul.
"Eric Grange" <egrange (AT) glscene (DOT) org> wrote
| Quote: | Hi all, I was wondering how I can sort the vertices of a 3d triangle
relative to a normal so they are anticlockwise around the normal?
Compute the triangle's plane normal with a cross product, then compute
the dot product of that normal vs your reference normal, if the result
is negative, you have to invert the order of the vertices.
Eric
|
|
|
| Back to top |
|
 |
Emi Guest
|
Posted: Thu Apr 22, 2004 3:49 pm Post subject: Re: Sorting 3d triangle points around normal to be anticlock |
|
|
i had the same trouble a few months ago, opening DXF files with wrong
normals.
i'm curious.. was this the case?
"Paul Nicholls" <.> wrote
| Quote: | Thanks Eric, I came up with this myself last night! <G
Thanks though :-)
Cheers,
Paul.
"Eric Grange"
news:40862686$1 (AT) newsgroups (DOT) borland.com...
Hi all, I was wondering how I can sort the vertices of a 3d triangle
relative to a normal so they are anticlockwise around the normal?
Compute the triangle's plane normal with a cross product, then compute
the dot product of that normal vs your reference normal, if the result
is negative, you have to invert the order of the vertices.
Eric
|
|
|
| Back to top |
|
 |
Paul Nicholls Guest
|
Posted: Thu Apr 22, 2004 11:07 pm Post subject: Re: Sorting 3d triangle points around normal to be anticlock |
|
|
No, I'm trianglulating points in 3d space and I had normals of triangles
that should have been facing in the opposite direction so I had to check and
sort the points if necessary...
"Emi" <emisosa_dot_hotmail_dot_com> wrote
| Quote: | i had the same trouble a few months ago, opening DXF files with wrong
normals.
i'm curious.. was this the case?
"Paul Nicholls" <.> wrote
Thanks Eric, I came up with this myself last night! <G
Thanks though :-)
Cheers,
Paul.
"Eric Grange"
news:40862686$1 (AT) newsgroups (DOT) borland.com...
Hi all, I was wondering how I can sort the vertices of a 3d triangle
relative to a normal so they are anticlockwise around the normal?
Compute the triangle's plane normal with a cross product, then compute
the dot product of that normal vs your reference normal, if the result
is negative, you have to invert the order of the vertices.
Eric
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|