View Full Version : Face normals

02-14-2002, 08:51 PM
How to calculate the normals(and normalize) of this quad?

GLfloat vertices_x1;
GLfloat vertices_y1;
GLfloat vertices_z1;

GLfloat vertices_x2;
GLfloat vertices_y2;
GLfloat vertices_z2;

GLfloat vertices_x3;
GLfloat vertices_y3;
GLfloat vertices_z3;

GLfloat vertices_x4;
GLfloat vertices_y4;
GLfloat vertices_z4;

02-15-2002, 12:05 AM
Assuming the quad is planar. Create two vector from one vertex to two other vertices. The normal is the crossproduct of the two vectors. To normalize it, divide all components by it's length.

It's very basic maths that one should understand when doing 3D graphics. Have a look here (http://www.flipcode.com/geometry/) .

02-15-2002, 12:52 AM
just for a little more speed when normalizing

calculate 1/length instead of length and multiply your components by this factor