danfis / libccd

Library for collision detection between two convex shapes
Other
504 stars 111 forks source link

Edge/Vertex order in ccd_pt_face_t #45

Closed hongkai-dai closed 5 years ago

hongkai-dai commented 6 years ago

Is there any ordering on the three edges, stored in ccd_pt_face_t? I want to compute the normal of a face, pointing away from the polytope. I compute the normal as n = e₁.cross(e₂), but this normal n does not necessarily points away from the polytope.

If the edges are always stored in a specific order (counter clockwise order, for example), then we can always guarantee the cross product e₁.cross(e₂) points away from the polytope. Does libccd guarantee such ordering? Is there a good way to always get the normal vector pointing away from the polytope?

danfis commented 5 years ago

There is no guarantee, you have to find where is inside and where outside of the polytope by other means.