MESHFACENORMALS Compute normal vector of faces in a 3D mesh.
NORMALS = meshFaceNormals(VERTICES, FACES)
VERTICES is a set of 3D points (as a N-by-3 array), and FACES is either
a N-by-3 index array or a cell array of indices. The function computes
the normal vector of each face.
The orientation of the normal is defined by the sign of cross product
between vectors joining vertices 1 to 2 and 1 to 3.
Example
[v e f] = createIcosahedron;
normals1 = meshFaceNormals(v, f);
centros1 = meshFaceCentroids(v, f);
figure; drawMesh(v, f);
hold on; axis equal; view(3);
drawVector3d(centros1, normals1);
pts = rand(50, 3);
hull = minConvexHull(pts);
normals2 = meshFaceNormals(pts, hull);
See also
meshes3d, meshFaceCentroids, meshVertexNormals, drawFaceNormals
drawMesh
Package: matgeom