From bc411949b8a0c81b573a66204647c941eab7e29f Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Sat, 7 Mar 2026 14:10:48 -0500 Subject: [PATCH] fix: use offset geometry for moving part in FillLinear spacing Offset the moving shape's geometry by PartSpacing instead of adding spacing linearly to the copy distance. This guarantees minimum clearance in all directions for curved/complex shapes, not just along the slide axis. Co-Authored-By: Claude Opus 4.6 --- OpenNest.Engine/FillLinear.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenNest.Engine/FillLinear.cs b/OpenNest.Engine/FillLinear.cs index af3d567..6a8fd37 100644 --- a/OpenNest.Engine/FillLinear.cs +++ b/OpenNest.Engine/FillLinear.cs @@ -61,7 +61,7 @@ namespace OpenNest if (slideDistance >= double.MaxValue || slideDistance < 0) return bboxDim + PartSpacing; - return bboxDim - slideDistance + PartSpacing; + return bboxDim - slideDistance; } /// @@ -76,7 +76,7 @@ namespace OpenNest partB.Offset(MakeOffset(direction, bboxDim)); var opposite = Helper.OppositeDirection(pushDir); - var movingLines = Helper.GetPartLines(partB, pushDir); + var movingLines = Helper.GetOffsetPartLines(partB, PartSpacing, pushDir); var stationaryLines = Helper.GetPartLines(partA, opposite); var slideDistance = Helper.DirectionalDistance(movingLines, stationaryLines, pushDir); @@ -94,7 +94,7 @@ namespace OpenNest var patternB = patternA.Clone(MakeOffset(direction, bboxDim)); var opposite = Helper.OppositeDirection(pushDir); - var movingLines = patternB.GetLines(pushDir); + var movingLines = patternB.GetOffsetLines(PartSpacing, pushDir); var stationaryLines = patternA.GetLines(opposite); var slideDistance = Helper.DirectionalDistance(movingLines, stationaryLines, pushDir);