Archived

This topic is now archived and is closed to further replies.

JasonDav

Question on direction of a normal.

Recommended Posts

JasonDav    122
I know that if vertices are specified anti-clockwise, then the the polygon is facing me, but in the following example where I calculate a normal, it is negative. Is it because of the way I calculated the edges? What is the correct way? I will let the vertices have the following values: V0 = (2,1,0) V1 = (0,3,0) V2 = (-2,1,0) Calculate the edge vectors from V1: E1 = V1-V0 = (0,3,0) – (2,1,0) = (-2,2,0) E2 = V1-V2 = (0,3,0) – (-2,1,0) = (2,2,0) Calculate the cross product of E1 and E2: C[x] = E1[y]*E2[z] – E1[z]*E2[y] = 0 – 0 = 0 C[y] = E1[z]*E2[x] – E1[x]*E2[z] = 0 – 0 = 0 C[z] = E1[x]*E2[y] – E1[y]*E2[x] = -4 – 4 = -8 C = (0,0,-8) Normalize the vector: VL = Sqrt (x^2+y^2+z^2) = Sqrt (0+0+64) = Sqrt (64) = 8 Normalized Vector = (x/VL, y/VL, z/VL) = (0,0,-1)

Share this post


Link to post
Share on other sites
Electron    122
You calculate the edge vectors wrong. Of course, you can calculate the normal using any edge vector in any direction, but only half of them will give you the right normal. In addition, to get a more accurate normal vector, you must use the same vertex as reference on both edge vectors.

(the edge vectors: (V1-V0),(V1-V2) does give the opposite direction of the normal as the vectors (V1-V0),(V1-V2))

My rule of thumb is that you use the edge vectors:
E1 = V1-V0;
E2 = V2-V0;



Electron

"The truth can be changed simply by the way you accept it."


Share this post


Link to post
Share on other sites