Files
OpenNest/OpenNest.Engine/BestFit
ajandClaude Fable 5.2 d4ad7a6201 perf(bestfit): slide a batch on boundaries prepared once, with the same distances
Best-fit slide distances rebuilt their band indexes for every offset: over
half of a slide's time and nearly all of its allocation (5.8 GB for the
225,684 slides of 51 drawings). CpuDistanceComputer now slides a batch
through Core's SlideBatch, which packs the two boundaries and builds their
vertices, contact topology and one band index per boundary and push axis
once. The pair search prepares each pair once for its first slides and its
settling slides (IPreparedDistanceComputer).

For pushes along an axis a slide also passes over pairs that cannot change
its answer: a vertex or curve outside the other boundary's whole extent
across the push, which every band test rejects, and, while the nearest
contact is searched for, a pair whose gap along the push already reaches
the nearest distance found, which the search discards. Both keep margins
for the kernels' own tolerances; a ray hits a line up to epsilon of its
length past its ends.

Every distance is bit for bit what the per-slide query returns:
CpuDistanceComputerEquivalenceTests compares the batch with a frozen copy
of the old computer on hand-built boundaries, grazing and touching starts
and the pair search's own batches. The per-slide sources and
SlideResolver are unchanged and remain what every other caller uses.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 14:37:04 -05:00
..