mirror of
https://github.com/ajisaacs/OpenNest.git
synced 2026-10-02 08:58:48 -04:00
Add DrawingAligner: bounded multi-start rigid ICP that maps a revised drawing's geometry into the old drawing-local frame as an operator-review seed. Material-filtered programs flatten through the shared chord-error machinery, resample via the shared ContourSampler ring scheduler, and fit closest bounded target segments with trimmed weighted least squares (reflection never solved, never applied). Seeds come from outer-centroid translation and MBR angle deltas with the 90-degree family plus identity. The stable outer boundary is fitted first; retained hole evidence only reorders candidates inside the outer tie band, so a moved hole cannot drag the perimeter. Structured AlignmentResult reports convergence, residual quantiles, bidirectional coverage, symmetry ambiguity, reflection uncertainty, and a bounded diagnostic IoU. Refusals (invalid input, insufficient support, unsupported topology, sample budget, cancellation) are reported as reasons, not thrown. Tests verify recovered poses against exact fixture geometry (true segments/arcs/circles, not sample clouds) for known transforms, symmetric rectangle/circle ambiguity, mirror non-selection, moved-hole perimeter preservation, and bounded region arithmetic (identical=1, disjoint=0).