Function exact_properties

Source
pub fn exact_properties(
    brep: &ExactBRep,
    tolerance: Tolerance,
) -> Result<MassProperties, ExactMeasureError>
Expand description

Mass properties of an exact B-rep.

§Method

A planar face bounded by straight edges is a polygon in 3-space. Fanning it into triangles about its first vertex and applying the divergence theorem gives volume, centroid and second moments in one pass – the same closed forms crate::mesh uses, but over the B-rep’s own boundary polygons rather than over a tessellation of them. For planar faces the fan is not an approximation: a planar polygon is exactly the union of its fan triangles.

Every other face – cylinders, cones, spheres, tori, elliptical cylinders, B-spline surfaces, and planar faces with an arc or ellipse on their boundary – contributes the same cone integrals over its own parameter domain, by Green’s theorem round its pcurves (see exact_face). Both paths use the same fields, so a solid mixing them sums consistently.

Orientation is honoured at every level: a face marked Orientation::Reversed, a reversed use of a face in its shell, and a reversed bound each flip the loop’s winding, exactly as audit_brep reads them. A correctly built solid yields a positive volume wherever it sits, without the caller pre-normalising anything. Every shell is summed, so a void shell, used reversed, subtracts its volume.

§Errors

Refuses an unknown surface family, a face whose pcurves do not bound a domain, an integral that does not converge, and a boundary that encloses nothing – never approximating any of them.