Calculating a Surface Normal

Revision as of 02:23, 5 April 2006 by Dorbie (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

A surface normal for a triangle can be calculated by taking the vector cross product of two edges of that triangle. The order of the vertices used in the calculation witt affect the direction of the normal (in or out of the face w.r.t. winding).

So for a triangle p1, p2, p3, if the vector U = p2 - p1 and the vector V = p3-p1 then the normal U X V is calculated by:

Nx = UyVz - UzVy Ny = UzVx - UxVz Nz = UxVy - UyVx