fix: add overlap safety check and diagnostics to FillGrid Step 2
FillGrid had no overlap check after perpendicular tiling of the row pattern (Step 2), unlike Step 1 which had one. When geometry-aware FindPatternCopyDistance underestimated row spacing, overlapping parts were returned unchecked. Changes: - Make FillLinear.HasOverlappingParts shape-aware (bbox pre-filter + Part.Intersects) instead of bbox-only, preventing false positives on interlocking pairs while catching real overlaps - Add missing overlap safety check after Step 2 perpendicular tiling with bbox fallback - Add diagnostic Debug.WriteLine logging when overlap fallback triggers, including engine label, step, direction, work area, spacing, pattern details, and overlapping part locations/rotations for reproduction - Add FillLinear.Label property set at all callsites for log traceability - Refactor LinearFillStrategy and ExtentsFillStrategy to use shared FillHelpers.BestOverAngles helper for angle-sweep logic Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -220,7 +220,7 @@ namespace OpenNest.Forms
|
||||
return;
|
||||
|
||||
var workArea = new Box(0, 0, plateSize.Length, plateSize.Width);
|
||||
var filler = new FillLinear(workArea, PartSpacing);
|
||||
var filler = new FillLinear(workArea, PartSpacing) { Label = "PatternTile-H" };
|
||||
|
||||
var hParts = filler.Fill(pattern, NestDirection.Horizontal);
|
||||
foreach (var part in hParts)
|
||||
@@ -228,7 +228,7 @@ namespace OpenNest.Forms
|
||||
hLabel.Text = $"Horizontal — {hParts.Count} parts";
|
||||
hPreview.ZoomToFit();
|
||||
|
||||
var vFiller = new FillLinear(workArea, PartSpacing);
|
||||
var vFiller = new FillLinear(workArea, PartSpacing) { Label = "PatternTile-V" };
|
||||
var vParts = vFiller.Fill(pattern, NestDirection.Vertical);
|
||||
foreach (var part in vParts)
|
||||
vPreview.Plate.Parts.Add(part);
|
||||
@@ -328,7 +328,7 @@ namespace OpenNest.Forms
|
||||
if (pattern == null)
|
||||
return;
|
||||
|
||||
var filler = new FillLinear(new Box(0, 0, plateSize.Length, plateSize.Width), PartSpacing);
|
||||
var filler = new FillLinear(new Box(0, 0, plateSize.Length, plateSize.Width), PartSpacing) { Label = "PatternTile-Apply" };
|
||||
var tiledParts = filler.Fill(pattern, applyDirection);
|
||||
|
||||
Result = new PatternTileResult
|
||||
|
||||
Reference in New Issue
Block a user