fix(engine): allow 0.0005 spacing slack in layout validation

Layouts placed exactly at the part spacing can land ~1e-4 short once
rotated, rounded (e.g. PEP's 4-decimal exports) and snapped to the
Clipper grid, so both validators rejected layouts that were correct in
practice. NestTolerances.SpacingSlack (0.0005, far below anything a
cutting machine resolves) is now subtracted from the spacing by
NestLayoutCheck's inflation and NestJobPlacementValidator's edge-distance
check. The frozen LegacyNestValidator takes the same rule so the
equivalence tests keep comparing like with like.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
aj
2026-09-25 14:19:04 -04:00
co-authored by Claude Opus 5.5
parent d1f3907505
commit 1b862dc1a8
6 changed files with 47 additions and 10 deletions
@@ -66,7 +66,8 @@ internal static class NestJobPlacementValidator
continue;
if (Overlaps(shape, other))
throw new InvalidOperationException("Candidate placements overlap.");
if (stock.PartSpacing > 0 && Distance(shape, other) < stock.PartSpacing - Epsilon)
if (stock.PartSpacing > 0
&& Distance(shape, other) < stock.PartSpacing - NestTolerances.SpacingSlack)
throw new InvalidOperationException(
"Candidate placements violate required part spacing."
);