Original Post
I''m currently working on the mesh class of my 3D Engine, and I''ve just written the code to validate a given polygon. By validate, I mean to check for two things:
1. That the polygon is convex.
2. That the polygon is planar.
Here''s what I''m doing now (psuedo-code):
1. Calculate face normal from first two edges (cross product), store in Normal.
2. for each edge do:
2.1. Calculate cross product between this edge and next edge, store in Vector.
2.2. If Vector not proprotional to Normal, face is non-planar - return False.
2.2. If proportion between Vector and Normal is negative or zero, face is concave - return False.
3. All edges passed the test - face ok; return True.
As you may notice, this requires one cross product for each edge in the polygon. I was wandering if anyone knows of a better way to do this?
Thanks in advance.
We come in peace... surrender or die!