Page 1 of 1

Face Normal Direction Calculation seems backwards

Posted: Tue Aug 09, 2005 6:10 am
by Duoas
Hi there. I have a question about the way blender calculates face normals. If you're not a math guru please take a second or third look at this question before answering...

Here's a C++ized version of what blender currently does (from arithb.c):

Code: Select all

point CalcNormXXX( point A, point B, point C, point &result )
{
        result = point( A -B ).cross( B -C );
        return result.normalize();
}
The thing I'd like to bring to your attention is the direction of the second vector: C-->B. The first is B-->A.

The common vertex is B, but only the first vector is relative to B. The second is relative to C. What this does is negate the direction of the BC vector, hence negating the direction of the face normal. In other words, the function should read:

Code: Select all

point CalcNormXXX( point A, point B, point C, point &result )
{
        result = point( A -B ).cross( C -B );
        return result.normalize();
}
Was this done on purpose? If so, why?

Thanks for any illumination you can provide.

Posted: Tue Aug 09, 2005 7:03 pm
by eric.m.forsythe
Normals are sometimes calculated this way in order to imply a winding direction (clockwise or counter-clockwise). (A-B) x (B-C) implies the winding direction CBA. (A-B) X (C-B) doesn't imply any sort of winding direction.

In the end, it's just a matter of personal taste...

Posted: Tue Aug 09, 2005 9:03 pm
by Duoas
That helps a lot. Thank you.