fix: compensate for inscribed polygon in offset distance

Polygon chords are always inside the actual arc, making the offset
boundary smaller than intended. Add PushChordTolerance to the offset
distance so the polygon conservatively overestimates, ensuring the
real offset geometry never overlaps stationary parts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 19:37:58 -05:00
parent 64cacf6d17
commit 30429ab955

View File

@@ -739,7 +739,7 @@ namespace OpenNest
return pts.Count > 0;
}
private const double PushChordTolerance = 0.08;
private const double PushChordTolerance = 0.03;
public static List<Line> GetPartLines(Part part)
{
@@ -765,7 +765,9 @@ namespace OpenNest
foreach (var shape in shapes)
{
var offsetEntity = shape.OffsetEntity(spacing, OffsetSide.Left) as Shape;
// Add chord tolerance to compensate for inscribed polygon chords
// being inside the actual offset arcs.
var offsetEntity = shape.OffsetEntity(spacing + PushChordTolerance, OffsetSide.Left) as Shape;
if (offsetEntity == null)
continue;