Triangle orientation

Triangle orientation

Postby Iltis » Mon Jun 04, 2018 7:57 pm


I'm creating faces with 3 points :
face = model.entities.add_face(pts)

Could you tell me if there is a way to know the orientation of the face according to the "direction of the rotation" between the 3 points?

Thank you very much.
User avatar

Re: Triangle orientation

Postby dezmo » Tue Jun 05, 2018 11:25 am

Looking at the face and the vertices order are clockwise you will see the back face.
So I assume you can determine the face normal direction according to points order, but it is depend of the viewpoint too...
You can test it e.g. if you put to ruby console:
Sketchup.active_model.active_entities.add_face([0, 0, 0],[0, 0, 1],[0, 1, 1])
check the orientation, delete and put this to check again:
Sketchup.active_model.active_entities.add_face([0, 1, 1],[0, 0, 1],[0, 0, 0])

Note that a special case exists for any face created on the ground plane, in which case the vertex order is ignored and the face is always facing down:
Man can do everything. Only a matter of time and money.


Re: Triangle orientation

Postby Iltis » Tue Jun 05, 2018 12:05 pm

Thank you very much for this explanation and for the special case.
It helps a lot.
User avatar

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Ad Machine 


Return to Developers' Forum

Who is online

Users browsing this forum: No registered users and 14 guests

Visit our sponsors: