pyblenderSDIC.meshes.TriangleMesh3D.compute_vertex_normals#
- TriangleMesh3D.compute_vertex_normals() None [source]#
Compute the normals of the vertices in the mesh.
The normals are computed as the average of the normals of the triangles that share each vertex. The result is stored in the
vertex_normals
attribute as a NumPy array of shape (N, 3), where N is the number of vertices and each row contains the normal vector of a vertex.The normals are normalized to have unit length.
from pyblenderSDIC.mesh import TriangleMesh3D # Create a TriangleMesh3D instance mesh = TriangleMesh3D(vertices=..., triangles=...) # Compute the normals of the vertices mesh.compute_vertex_normals() # The normals are now available in the `vertex_normals` attribute mesh.vertex_normals
Note
The normals of triangles must be computed before calling this method.