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>
Repo-wide sweep with the pinned CSharpier 1.3.0 tool. Whitespace and
line-wrapping only; OpenNest.Engine.Tests (109) and OpenNest.IO.Tests
pass after reformat, full solution builds 0 errors.
Added .csharpierignore so csproj/config XML keeps its existing layout
(CSharpier's XML wrapping churns attributes with zero benefit).
Formatting is now enforceable: dotnet csharpier check . passes.
Add Phase 3 curve-to-curve direct distance in CpuDistanceComputer to
catch contacts that vertex sampling misses between curved entities.
Enforce minimum copy distance in FillLinear to prevent bounding box
overlap when circumscribed polygon boundaries overshoot true arcs.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Try all valid best fit pairs instead of only the first when qty=2,
picking the best via IsBetterFill comparer (fixes suboptimal plate
selection during auto-nesting)
- Pre-compute best fits across all plate sizes once via
BestFitCache.ComputeForSizes instead of per-size GPU evaluation
- Early exit plate optimizer when all items fit (salvage < 100%)
- Trim slide offset sweep range to 50% overlap to reduce candidates
- Use actual geometry (ray-arc/ray-circle intersection) instead of
tessellated polygons for slide distance computation — eliminates
the massive line count from circle/arc tessellation
- Add RayArcDistance and RayCircleDistance to SpatialQuery
- Add PartGeometry.GetOffsetPerimeterEntities for non-tessellated
perimeter extraction
- Disable GPU slide computer (slower than CPU currently)
- Remove dead SelectBestFitPair virtual method and overrides
Reduces best fit computation from 7+ minutes to ~4 seconds for a
73x25" part with 30+ holes on a 48x96 plate.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract distance computation from RotationSlideStrategy into a pluggable
IDistanceComputer interface. CpuDistanceComputer adds leading-face vertex
culling (~50% fewer rays per direction) with early exit on overlap.
GpuDistanceComputer wraps ISlideComputer with Line-to-flat-array conversion.
SlideOffset struct uses direction vectors (DirX/DirY) instead of PushDirection.
SpatialQuery.RayEdgeDistance(dirX,dirY) made public for CPU path.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>