PDA

View Full Version : Normal Calculation Issue



Nat
06-14-2001, 03:37 PM
Hello everyone,

I'm attempting to calculate the normal for a given triangle and I'm having an issue. My normal point just seems off, instead of being in the center of the triangle and 1.0f distance away from the triangle in the direction it is facing, it is lying right on the triangle very close to one of the points. I have a picture below, the red point is the normal point, the yellow points are the 2 vectors (b-a, c-a).
http://www.teamgoat.com/nat/normal.jpg

and I also have the code I'm using to calculate the normal at the next url
http://www.teamgoat.com/nat/normal.cpp

I can't seem to get this to work =( Any help / sudgestions are GREATLY apretiated.

Thank You!!

Nat

MrShoe
06-15-2001, 12:13 AM
A normal does not have a starting position itself. It is a vector represented as 3 coordinates, x, y, z. The length of the normal is 1 and the distance from the 0, 0, 0 to x, y, z, is its length.

Tim Stirling
06-15-2001, 12:58 AM
Once you have calculted the normal you neeed to work out the centre of the tringle and drwn a line from the centre to the centre + normal- thats how I do it.