## Getting the Normal for a polygon.

Member
Posts: 23
Joined: 2006.12
Post: #1
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!
Member
Posts: 156
Joined: 2002.10
Post: #2
First, you need to think about whether the 4-points 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
Member
Posts: 23
Joined: 2006.12
Post: #3
Ah! That was just enough information to get it working! Thanks a ton.
Member
Posts: 51
Joined: 2009.02
Post: #4
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 9,579 Apr 13, 2011 11:35 PM Last Post: OptimisticMonkey Polygon budgets Kerome 1 2,615 Mar 7, 2010 04:55 AM Last Post: mikey glut polygon winding strangeness OptimisticMonkey 2 2,755 Sep 7, 2009 06:27 PM Last Post: OptimisticMonkey Vector (Normal) Map blending operations? kelvin 10 6,249 Mar 16, 2007 04:31 PM Last Post: OneSadCookie Is there anything like polygon offset for GL_LINES? TomorrowPlusX 2 3,259 Jan 24, 2007 02:57 PM Last Post: TomorrowPlusX