Skip to main content
GameDev.net gamedev.net
🔒 Locked

Polygon Validation

Started by technobot Jan 5, 2003 at 9:54 AM 0 replies 850+ views
Original Post
technobot
technobot
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!
Michael K.
ga
ga
i think you can''t do anythinh better than these cross products but you won''t do the validation very often, you should do it only when loading 3d data (or even don''t do it at all).
Visit our homepage: www.rarebyte.de.stGA

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.