Module planes

Source
Expand description

Planar regions of a triangle mesh (#131).

§Grown, then certified

Regions grow from the largest unassigned triangle across shared edges, taking a neighbour when its normal is within the angle of the region’s and its corners within the distance of the region’s plane; the plane is refitted (area-weighted normal and centroid) as the region grows.

Growing decides in floating point; what is reported is then proven. For the plane given – a point and a normal, both f64, so an exact plane – DetectedPlane::deviation bounds the distance of every corner of every member triangle from it, computed in outward-rounded intervals. A triangle that pushes the bound past the requested distance (plus the few ulps any fitted plane is off, so exactly flat regions hold together at distance zero) is peeled off the region until the bound holds. So every region’s corners, and so its whole surface, lie within deviation of its plane.

DetectedPlane::coplanar says more when it holds: every corner lies on one plane exactly, decided by exact orient3d.

Structs§

DetectedPlane
One planar region.
PlaneTolerance
How far a region may depart from a plane.

Enums§

PlaneError
Why no segmentation was made.

Functions§

detect_planes
The mesh cut into planar regions, largest first; triangles of no area belong to none.