Getting the Normal for a polygon.
A quick question, how can I get the normal for a polygon if all I have is the (x,y,z) for the 4 corners of said polygon? Any links that would explain the math behind this would also be appreciative.
Thanks!
Thanks!
First, you need to think about whether the 4points of the polygon are coplanar (i.e. they lie in the same plane). If not, you can't define a single face normal for the polygon since it's not flat.
In general, 3 points in space can be used to define a plane, so pick three points on your plane (three of the vertices, call them A,B,C). Construct vectors AB and AC (any combinations will do). Take the vector cross product of AB & AC and you will get a vector that is normal (perpendicular) to the plane. Depending on your needs you may wish to normalise the vector by scaling it by 1/normal_length so it has unit magnitude.
Cheers
 Iain
In general, 3 points in space can be used to define a plane, so pick three points on your plane (three of the vertices, call them A,B,C). Construct vectors AB and AC (any combinations will do). Take the vector cross product of AB & AC and you will get a vector that is normal (perpendicular) to the plane. Depending on your needs you may wish to normalise the vector by scaling it by 1/normal_length so it has unit magnitude.
Cheers
 Iain
Ah! That was just enough information to get it working! Thanks a ton.
It's not a polygon if the points aren't coplanar.
Possibly Related Threads...
Thread:  Author  Replies:  Views:  Last Post  
Normal Mapping Precision on iOS  OptimisticMonkey  6  50,637 
Apr 13, 2011 11:35 PM Last Post: OptimisticMonkey 

Polygon budgets  Kerome  1  4,010 
Mar 7, 2010 04:55 AM Last Post: mikey 

glut polygon winding strangeness  OptimisticMonkey  2  4,848 
Sep 7, 2009 06:27 PM Last Post: OptimisticMonkey 

Vector (Normal) Map blending operations?  kelvin  10  10,341 
Mar 16, 2007 04:31 PM Last Post: OneSadCookie 

Is there anything like polygon offset for GL_LINES?  TomorrowPlusX  2  5,150 
Jan 24, 2007 02:57 PM Last Post: TomorrowPlusX 