# Thread: Finding the normals of points

1. ## Finding the normals of points

Could some please provide some sample code for finding the normals of vertices (as opposed to surfaces)? I generally use triangles, but code for quads would be appreciated too!

Andrew

2. ## Re: Finding the normals of points

If P1 is your first point, P2 your second, and P3 your third, and if they are counter-clockwise, treating them as vectors you can write:
Edge1 = P1 - P2
and
Edge2 = P3 - P2
and then compute the normal using the crossprodukt:
Normal = Edge1 X Edge2
last step is to normalie it
Normal=Normal/|Normal|

hope that helps
Chris

[This message has been edited by DaViper (edited 03-02-2001).]

[This message has been edited by DaViper (edited 03-02-2001).]

3. ## Re: Finding the normals of points

To calculate vertex normals simply take the average of all the face normals that are connected by that vertex. The only dificulty is finding which faces are connected, this depends on your data and structure.

4. ## Re: Finding the normals of points

Chris, that was exactly what I needed. Thank you very much!

cheers,
Andrew

5. ## Re: Finding the normals of points

Chris's method would only give you the face normal, if this is what you want then fine but i think you wanted vertex normals in which case you will also have to do what I said and calculate the average normal of the faces attached to that vertex.

6. ## Re: Finding the normals of points

Andrew, Tim is right my calculations only give you the face normals, if you want the average of all normals you have to do what Tim said

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•