Skip to main content

Module cut

Module cut 

Source
Expand description

Cutting an editable mesh by a plane, and capping the cut flat.

§The cut

Which side of the plane each vertex lies on is section’s: decided once per vertex by the exact orientation predicate, a vertex in the plane counting as above. A vertex within rounding of the plane, so near that it and its foot on the plane could take the same coordinates in it, or one the crossing of an edge from it lands within rounding of, is snapped onto it: it counts as in the plane, so that no new vertex crowds it and no sliver is left between it and the plane.

A face whose corners all lie on the kept side stays, one whose corners all lie on the other goes, and one whose corners disagree is clipped: its kept part, a triangle or a quadrilateral, takes its place as new faces. An edge whose ends disagree is cut at one vertex, shared by every face on the edge: its upper end where that lies in the plane, as section cuts it, and otherwise a new vertex standing where section puts that point of its chain, to the bit. A face lying in the plane goes with the side its material is on, as it does for section: kept above where it faces down, its material above it, and not otherwise.

§The caps

The rims the cut leaves lie in the plane where both ends of every edge do: a cut vertex, a vertex in the plane, or one snapped onto it. A rim lying wholly in the plane is a loop. A rim that leaves the plane and comes back leaves runs in it, and the end of one run is joined to the start of another where they are one point, or by a straight segment, a bridge, where they lie within the cap’s bridge of each other, nearest pairs first; runs joined round into a loop make one.

The loops are capped together, so loops within loops give discs, rings and discs within rings: each loop, run with the kept side’s cap on its left seen from the side the normal points to, winds once about the points of the cap and not at all about the rest. The cap is the faces of the constrained Delaunay triangulation of the loops’ points, in the plane’s coordinates, that the loops wind about once, each wound outward from the kept side. Its corners are the rim vertices themselves, and every loop edge is an edge of it, so the cap shares each rim edge with the face beyond it.

A loop is left open where that cannot hold: where two of its points land on one point of the plane, where an edge of it crosses another or runs through a point, or where the cap’s side of an edge is not wound about once and the far side not at all, as where two bodies overlap. The other loops are then capped again without it.

Structs§

Cap
How a cut is capped.
CutReport
What a cut capped and what it left open.

Enums§

Side
The side of a plane a cut keeps.