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:
@@ -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)
|
||||
{
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using OpenNest.Engine.BestFit;
|
||||
using OpenNest.Forms;
|
||||
using OpenNest.Gpu;
|
||||
|
||||
namespace OpenNest
|
||||
{
|
||||
@@ -13,7 +11,6 @@ namespace OpenNest
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
BestFitCache.CreateEvaluator = GpuEvaluatorFactory.Create;
|
||||
Application.Run(new MainForm());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user