Advertisement

Detailed explanation of normals.

Started by September 01, 2001 03:41 PM
3 comments, last by HelplessFool 23 years, 5 months ago
I was just wondering if someone could give me an explanation of how the math for normals actually works like getting the vector and calculating the normals off of the vectors or points. I''ve read how to do it a couple of places but it doesn''t make any sense most of the time. They just tell you how to do it and say it will work. any links or info will be appreciated. thanks in advance. "Those who want it, but can''''t get it, will complain about it.
You could try out http://nate.scuzzy.net/docs/normals/
Advertisement
Given vectors x = < 1,0,0 > and y = < 0,1,0 >, when you cross them, you get a vector that is perpendicular to both. In our our case, these vector represent the x and y axis, respectively. When we cross them, we expect to get back the z axis or < 0,0,1 >, since this satisfies the definition of a cross product.

A normal vector "just happens" to be any vector perpendicular to a plane. Hmm.. sounds like the cross product. We see this is true because two vectors form a plane. Thus we can pick any two vectors that lie an that plane and cross them to get the normal.

In our case, the vectors x and y form the x-y plane. The z axis, and therefore the normal vector, should stick out of the x-y plane.

Here's the math for cross products:
X x Y =   = < 1,0,0 > x < 0,1,0 >   = | i j k |    | 1 0 0 |    | 0 1 0 | 


Since I use one of those helpful math tricks, this is also "equal" to :
  = | i j k i j|    | 1 0 0 1 0|    | 0 1 0 0 1| 


Now you just multiple each diagonal line and add them in one direction, do the same but in the othe direction and subtract from your previous answer to get your vector (in < i,j,k > form). I'll just do a few
  = |(i) j  k  i  j| = 0*i    | 1 (0) 0  1  0|    | 0  1 (0) 0  1|  = | i (j) k  i  j| = 0*i + 0*j    | 1  0 (0) 1  0|    | 0  1  0 (0) 1|...  = | i  j (k) i  j| = 0*i + 0*j + 1*k - (0*k)    | 1 (0) 0  1  0|    |(0) 1  0  0  1|...  = 0*i + 0*j + 1*k - (0*k + 0*i + 0*j)  = 0*i + 0*j + i*k  = < 0,0,1 > 


And viola you have it--the z axis!

Jinushaun

Edited by - jinushaun on September 1, 2001 12:07:05 AM
Here's the quick and dirty (read: direct) way to find a cross product:

a x b = (a[1]*b[2] - a[2]*b[1])i + (a[2]*b[0] - a[0]*b[2])j + (a[0]*b[1] - a[1]*b[0])k

Oh yeah, since the normal is always perpendicular to the plane, you can infer which direction the plane (or the case of 3D objects: face) is facing.

Oh yeah, X cross Y != Y cross X (equals < 0,0,1 > and < 0,0,-1 > respectively). This is true because when we say a vector perpendicular to a plane, you have to ask, "which direction?!?!". A table has TWO normals, one pointing up and one pointing down, both are perpendicular.

Jinushaun

Edited by - jinushaun on September 1, 2001 12:20:02 AM
THANK YOU


"Those who want it, but can''''t get it, will complain about it.

This topic is closed to new replies.

Advertisement