Function outward_orientation

Source
pub fn outward_orientation(mesh: &TriMesh) -> Option<bool>
Expand description

Whether a closed mesh is outward-oriented.

A face-counting majority does not work: a hollow section’s inner wall legitimately faces the opposite way from its outer wall, and for a thin tube the two counts are comparable. Orientation is a property of the enclosed volume, not of how faces point relative to a centre.

So the volume is summed exactly. Each tetrahedron about the reference point contributes a . (b x c), and those contributions are accumulated in expansion arithmetic rather than f64, so the final sign is certified even when the terms cancel catastrophically – which is exactly what happens for a thin plate or a large solid far from the origin.

Returns None when the mesh encloses exactly zero volume, which is not an orientation and must not be reported as one.