# normal of complex face

This topic is 3270 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

Hy. I know that for find a normal of a triangle i can execute the dot product of two faces , is corrct? but how i can find the normal of more "complex" faces? The faces are a T section face , i use it for a civil structure project. I also must find the normal of a T L C ecc.. faces. How? Thanks

##### Share on other sites
er... no. To find the normal of a triangle, you take the cross product of two of the edges. Be careful about the winding order (picking edges around clockwise or counterclockwise), or your will end up with a normal that faces the wrong way.

1) The simplest way is that you still probably use triangles to draw those faces, so just average the normals of all the triangles on that face. OR if you know the face is flat, just use the normal of a single triangle.

2) If they are flat faces, you only need any two, non-parallel lines on the surface of the face. Cross those lines, and get the normal (or its inverse).

3) If those aren't flat. Then they aren't going to have a normal, but many.

##### Share on other sites
Thanks.
But i can have flat face and no flat face , then i must identify by the geometry if a face is flat or no, and if is flat find his normal with the cross product of two non parallel lines.
How i can find that a face is flat?
I also have the axis if this can help.
thanks.

##### Share on other sites
Well, you could always check that all the vertices are coplanar... Since any three vertices must lie in a plane, I would get a plane from the normal of a triangle formed by any three vertices (direction doesn't matter), then use one of those points as the plane's point. Now, with this plane, check against all other points to see if they lie in this plane (simple boolean test). If all points are coplanar (return true for being in the plane), then the entire polygon is indeed planar ("flat").

So basically all you need is a point-on-plane boolean test, like this:

bool PointOnPlane( Point &p, Plane &pl )
{
return ( (pl.point - p) dot (pl.normal) == 0 );
}

... and of course, floating point precision may be off, so you probably instead of checking for equality to 0 want to check the absolute value of the dot against some very small threshold value.

-Pravin

1. 1
2. 2
3. 3
Rutin
15
4. 4
khawk
13
5. 5
frob
12

• 9
• 9
• 11
• 11
• 23
• ### Forum Statistics

• Total Topics
633665
• Total Posts
3013246
×