m3sh.traits.
face_normal#
- face_normal(face)#
Face normal vector.
Compute face normal as cross product of edge vectors. This function assumes that vertex coordinates live in Euclidean 3-space.
- Parameters:
- faceFace
Face of a mesh.
- Returns:
- normalndarray, shape (3,)
Unit length normal vector. For triangular faces this vector is consistent with the face orientation. Faces marked as deleted are assigned a vector of
nanvalues.
See also
Notes
For a non-triangular face the normal is computed by averaging vectors obtained as cross products of consecutive edge vectors around the face. This approach can be problematic for non-convex faces as some of those vectors point to the wrong side.