Skip to main content

Module clean

Module clean 

Source
Expand description

Post-quantization cleanup of the shared arcs. Snapping arc vertices to a coarse grid (especially i16, ~611 m cells) collapses nearby vertices and folds thin features onto themselves, leaving consecutive duplicates, zero-area spurs where the path reverses over itself (“spikes”), and rings whose area vanishes entirely. Left in, the spurs self-overlap and flip the runtime’s even-odd PIP parity inside the fold.

Every fix runs on the shared arcs (or drops whole rings), never on one polygon in isolation, so neighbouring zones stay stitched by construction; cleaning a border cleans it identically for both owners.

Structs§

CleanStats

Functions§

clean_arc
Removes quantization artifacts from one quantized arc, in place.
drop_degenerate_rings
Drops rings that quantization collapsed to zero area: a degenerate hole vanishes alone, and a degenerate exterior takes its holes with it. Arcs that no surviving ring references are removed, and their ids are compacted. Returns the filtered (ring_refs, structure, arcs) mirroring Topology’s fields. Dropping a zero-area ring can’t open a crack with a neighbour: there was no area to disagree about.
ring_coords_q
Assembles one ring’s quantized coords from its signed arc refs, the integer twin of Topology::reconstruct()’s ring assembly.
ring_degenerate
Reports whether the ring collapsed under quantization: fewer than 3 vertices remain, or the shoelace area is exactly 0 with no proper self-crossing. The crossing exemption matters: a bowtie with equal opposite lobes has signed area 0 yet still covers both lobes under the runtime’s even-odd rule. Dropping it would lose real coverage. The computation is exact in i128 for all qbits.

Type Aliases§

CleanedTopo
The (ring_refs, structure, arcs) triple mirroring Topology’s fields, with arcs quantized to integer coordinates.