Expand description
The volume between a scanned mesh and the solid it was made to: the material the solid has and the scan lacks, and the material the scan has beyond the solid, as connected regions.
§The grid
Space over both bodies’ boxes is cut into cubic cells cell wide, and
each cell is read at its centre, its node. A node is in the scan by the
parity of the scan’s crossings along the line through it parallel to
x (parity), exactly, and on the scan counts as
in it. A node is in the solid by the same parity against the solid
meshed at a sixteenth of a cell. Where the node lies within that chord,
plus the confusion distance, of the solid’s mesh, the band where the
mesh and the solid can disagree, it is read again against the solid’s
own surfaces by SolidBoundary::holds, and on the solid counts as in
it. A node in the solid and out of the scan is missing material; one in
the scan and out of the solid is excess material.
§Holes in the scan
Vertices of the scan at one position are made one first, so a mesh
stored as loose triangles reads as the surface they make. The parity
needs every edge used an even number of times; a scan with an edge
used an odd number of times, a hole’s rim, is closed first, each rim
filled flat with Editable::fill on its own vertices. A differing
node whose nearest point on the closed scan lies on a fill was not seen
by the scanner: it takes the solid’s side, so a hole reports no
material either way.
Such a node is doubtful, and so is every node within a cell of a fill, where the fill may stand where the scan would have, and a node the solid’s surfaces could not classify, every ray meeting a degeneracy, which keeps the reading of the solid’s mesh.
§Regions
Nodes that differ the same way are joined across faces, edges and
corners into regions. A region’s volume is its nodes’ count times a
cell’s volume. A node is counted where its centre lies, so the volume
is off by at most the cells the region’s boundary passes through: about
the boundary’s area times √3 cells, and less where the boundary’s
errors cancel, as they do on a surface not aligned to the grid.
A region’s depth is how far apart the two surfaces stand across it: the greatest distance, from a vertex of either surface within a cell of the region’s cells, to the other surface. A vertex of the scan is measured to the solid’s mesh, within its chord of the solid, and a vertex of the solid’s mesh to the closed scan. A boss standing off a face reads its height, from its top; a pocket its depth, from its floor. A region no vertex comes near reads the greatest distance from its nodes to either surface.
A region shallower than a cell is below the grid’s resolution, which puts at least one node into a slab a cell thick, wherever the grid falls and however the slab is turned, but not into a thinner one: it is not reported. A noisy scan lifts single nodes off its surface all over, and each is that shallow.
§Layers and lumps
A region d deep and V in volume is as wide as a square slab of that
thickness, w = √(V / d). It is a Form::Layer, a face standing
off, where the slab’s two faces have more area than its four sides,
2 w² ≥ 4 w d, so where V ≥ 4 d³; otherwise a Form::Lump.
§Unsure
A region is Region::unsure where a doubtful node lies within a cell
of one of its nodes, or where it is shallower than two cells. Then its
extent rests on nodes nobody measured, or its volume error, about its
area times √3 cells against its area times its depth, can reach its
whole volume.
§Cost
Each row of nodes along x is read in parallel, at a parity line
through each body and an exact classification of the nodes in the
solid’s band, an eighth of those within a cell of its surface.
Rows are read and regions numbered in the grid’s order, so the answer
is the same bit for bit on any thread count.
Structs§
- Region
- A connected volume where the scan and the solid differ the same way.
Enums§
Functions§
- volume_
difference - The regions where
mesh, a scan, and the solidshapediffer, on a grid of cellscellwide; see the module documentation.