Sign in to follow this  
mshr25

Finding outward face normals

Recommended Posts

Hello,all! I have a surface described by triangular mesh when I get the list of vertixes belonging to each triangle and the list of triangles. I want to find outward normals for every triangle, however, I don't know whether the order of the vertixes obeys the right hand rule. What I do succeed to do is to define a correct normal for one triangleor define a point inside or outside the surface (if it is closed) or a point at the visible side (if the surface is not closed). Is there a way to define all the normals as they should be? Thanks, mshr25

Share this post


Link to post
Share on other sites
When you know which direction that the normal for 1 triangle points and if all your triangles use shared vertices then search for a neighbouring triangle and calculate it's normal, also get the vector going between the unshared vertices of the 2 triangles. Calculate two dot products using that vector and the two normals, multiply those 2 results and if the result is positive then you have to reverse the new normal. There may be small errors which could cause problems with triangles that are on the same plane so you may need check for that or test against a small positive value rather than testing with >0.0

if your vertices aren't all shared then you'll need to search for triangles that have two vertices with matching coords.

Someone else might have an easier/simpler way but that's all I can think of at the moment.

Share this post


Link to post
Share on other sites
Just thought of another method, since you say you can find a point either inside or outside of the object then for each triangle calculate the normal and add that to the coords of one of your triangles vertices. then using the line from that coord to your known point do intersection tests on all the triangles of your object and count the number of tests that pass, you can tell if the normal is pointing the right way if the number of intersections is even or odd (depending on whether your known point is inside or outside).

EDIT:
There could be problems with this where the outside faces of 2 tris are facing toward each other, instead of adding the normal to a vertex you could maybe find a point in the triangle by averaging the 3 vertices or something and then add a small fraction of the normal.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this