mesh.Mesh.check_triangle_mesh#

Mesh.check_triangle_mesh()#

Perform a topological check of a triangulated surface mesh (tri3).

The following properties are examined:

  • Manifoldness: A mesh is manifold if every edge belongs to at most two triangles. Non-manifold edges are edges shared by more than two triangles.

  • Consistency of normals: Adjacent triangles should have a coherent orientation. If the face winding is inconsistent, normals may point in opposite directions for neighboring faces. Since winding is only well-defined on manifold surfaces, a non-manifold mesh is always reported as having inconsistent normals.

  • Watertightness (closed surface): Every edge is shared by exactly two triangles and there are no boundary edges (edges belonging to only one triangle). A surface can be manifold but still not watertight, e.g., if it has holes or boundaries.

  • Valid volume: If a surface is manifold, has consistent winding, is watertight, and its normals are directed outward, then it is considered a valid volume.

Returns#

dict

Dictionary with boolean keys:

  • ‘manifold’: True if no non-manifold edges

  • ‘consistent_normals’: True if triangle winding is consistent

  • ‘watertight’: True if the surface is manifold and has no boundary edges

  • ‘valid_volume’: True if watertight and all normals are outward facing

Examples#

>>> from hellotriangle import shapes
>>> mesh = shapes.cuboid()
>>> print(mesh.check_triangle_mesh())
{'manifold': True, 'consistent_normals': True, 'watertight': True, 'valid_volume': True}
>>> mesh_inward_normals = mesh.reverse()
>>> print(mesh_inward_normals.check_triangle_mesh())
{'manifold': True, 'consistent_normals': True, 'watertight': True, 'valid_volume': False}