Face Normal Direction Calculation seems backwards

Compiling, libraries, modules, coding guidelines and porting

Moderators: jesterKing, stiv

Post Reply
Duoas
Posts: 0
Joined: Mon Apr 18, 2005 10:32 am

Face Normal Direction Calculation seems backwards

Post 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.

eric.m.forsythe
Posts: 0
Joined: Thu Jun 23, 2005 3:26 pm

Post 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...

Duoas
Posts: 0
Joined: Mon Apr 18, 2005 10:32 am

Post by Duoas »

That helps a lot. Thank you.

Post Reply