newton.utils.validate_triangle_mesh#

newton.utils.validate_triangle_mesh(vertices, indices, *, min_area=1e-6, max_aspect_ratio=20.0, min_angle_deg=5.0, label=None, stacklevel=2)[source]#

Check a triangle mesh for quality issues and emit warnings.

Inspects the input triangle mesh for degenerate or sliver triangles and extreme interior angles. Non-manifold-edge detection is not performed here; MeshAdjacency emits its own warning during construction and is built by every builder path that accepts a triangle mesh, so going through add_cloth_mesh / add_soft_mesh already covers it. Standalone callers who need a non-manifold check should construct MeshAdjacency(indices) themselves. Each detected problem is reported via warnings.warn().

Parameters:
  • vertices (ndarray) – Vertex positions [m], shape (N, 3).

  • indices (ndarray) – Triangle vertex indices, shape (F, 3).

  • min_area (float) – Minimum triangle area [m²]. Default 1e-6 (1 mm²).

  • max_aspect_ratio (float) – Maximum longest-edge / shortest-altitude ratio. Default 20.0 — flags slivers whose worst interior angle is below ~3° while staying quiet on rough-but-fine production meshes.

  • min_angle_deg (float) – Minimum interior angle [deg]. Default 5.0.

  • label (str | None) – Optional name included in the warning message so callers can identify which mesh tripped the warning when validating many meshes.

  • stacklevel (int) – Passed to warnings.warn() so the warning points at the caller’s frame.