BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sorting 3d triangle points around normal to be anticlockwise

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Paul Nicholls
Guest





PostPosted: Wed Apr 21, 2004 3:02 am    Post subject: Sorting 3d triangle points around normal to be anticlockwise Reply with 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?

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





PostPosted: Wed Apr 21, 2004 7:48 am    Post subject: Re: Sorting 3d triangle points around normal to be anticlock Reply with quote



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





PostPosted: Thu Apr 22, 2004 12:21 am    Post subject: Re: Sorting 3d triangle points around normal to be anticlock Reply with quote



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





PostPosted: Thu Apr 22, 2004 3:49 pm    Post subject: Re: Sorting 3d triangle points around normal to be anticlock Reply with 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

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





PostPosted: Thu Apr 22, 2004 11:07 pm    Post subject: Re: Sorting 3d triangle points around normal to be anticlock Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.