fix(fill): keep interlocked pairs that end within tolerance of an inner edge

With clamps on the sheet, Fill Area's clamp-clear check allowed only 1e-6
of overhang at an area edge that is not the sheet's, while the fillers
allow the geometry tolerance at every edge. An interlocked pair whose
partner ended a few millionths past the selected box lost both parts, so
a box that holds two pairs of triangles got two singles. Inner edges sit
at least the part spacing (or a clamp keep-out's spacing slack) from
material, so allow the tolerance there when the spacing covers it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ajandClaude Opus 5.5 committed 2026-11-24 15:25:58 -05:00
1 parent d4ad7a6201
commit 95e933b1ea
2 files changed
+30 -3

No files matched your search

@@ -247,6 +247,28 @@ public class ClampZoneInteractiveFillTests
AssertClearOfClamps(parts, new Box(5, 0, 1, 0.5));
}
[Fact]
public void FillAreaKeepsToleranceOverhangAtAnInnerEdgeHeldOffByPartSpacing()
{
// A fill's interlocked partner can end a few millionths past the selected box (the
// fillers' geometry tolerance); with clamps on the sheet both partners were dropped.
var plate = MakePlate(new ClampZone("front-1", ZoneA));
var area = new Box(30, 5, 4, 10);
var overhang = OpenNest.Math.Tolerance.Epsilon * 0.5;
var drawing = RectDrawing(2, 2);
var item = new NestItem { Drawing = drawing };
var proposed = new List<Part>
{
new(drawing, new Vector(area.Left, area.Bottom)),
new(drawing, new Vector(area.Right - 2 + overhang, area.Bottom + 3)),
};
var parts = PlateFillService.FillDroppingClampHits((_, _, _) => proposed.ToList(),
plate, item, new List<NestItem> { item }, area, null, CancellationToken.None);
Assert.Equal(2, parts.Count);
}
[Fact]
public void PackAreaNeverPacksInsideClampKeepOut()
{