fix: use CPU evaluator for best-fit cache, remove broken GPU dilation

The GPU bitmap evaluator produces false overlap detections due to
discretization errors at cell boundaries. Use the CPU PairEvaluator
(exact geometric intersection) for now. Also remove the double-counted
spacing dilation from GpuPairEvaluator for when GPU is revisited.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-08 14:20:13 -04:00
parent 3220306d3a
commit c28d5d8c12
2 changed files with 4 additions and 6 deletions

View File

@@ -33,8 +33,9 @@ namespace OpenNest.Gpu
if (candidates.Count == 0)
return new List<BestFitResult>();
var dilation = _spacing / 2.0;
var bitmapA = PartBitmap.FromDrawing(_drawing, _cellSize, dilation);
// No dilation — candidate positions already include spacing
// (baked in by RotationSlideStrategy via half-spacing offset lines).
var bitmapA = PartBitmap.FromDrawing(_drawing, _cellSize);
if (bitmapA.Width == 0 || bitmapA.Height == 0)
return candidates.Select(c => MakeEmptyResult(c)).ToList();
@@ -53,7 +54,7 @@ namespace OpenNest.Gpu
var groupItems = group.ToList();
// Rasterize B at this rotation
var bitmapB = PartBitmap.FromDrawingRotated(_drawing, rotation, _cellSize, dilation);
var bitmapB = PartBitmap.FromDrawingRotated(_drawing, rotation, _cellSize);
if (bitmapB.Width == 0 || bitmapB.Height == 0)
{