meshing.diagnostics.triangle_quality

meshing.diagnostics.triangle_quality(mesh)

Triangle shape statistics: minimum angles, aspect ratios, degeneracy.

The aspect ratio is the longest edge over the smallest altitude (l_max^2 / (2 area)), which is 2 / sqrt(3) ≈ 1.155 for an equilateral triangle and grows without bound for slivers. Triangles with area below 1e-12 are counted as degenerate and excluded from the percentile statistics (which are nan if nothing remains).

Parameters

Name Type Description Default
mesh Mesh The mesh to measure. required

Returns

Name Type Description
dict[str, Any] Dict with min_angle_p5 / min_angle_p50 (degrees),
dict[str, Any] aspect_p50 / aspect_p95, degenerate_count, and
dict[str, Any] triangle_count.