fix: remove self-intersecting loops from polygon offset
Polygon offset at concave corners creates geometry that folds back through itself. Added RemoveSelfIntersections() to Polygon that detects non-adjacent edge crossings and removes the smaller loop at each crossing. Applied to both collision detection and rendering. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -789,6 +789,7 @@ namespace OpenNest
|
||||
continue;
|
||||
|
||||
var polygon = offsetEntity.ToPolygonWithTolerance(PushChordTolerance);
|
||||
polygon.RemoveSelfIntersections();
|
||||
polygon.Offset(part.Location);
|
||||
lines.AddRange(polygon.ToLines());
|
||||
}
|
||||
@@ -810,6 +811,7 @@ namespace OpenNest
|
||||
continue;
|
||||
|
||||
var polygon = offsetEntity.ToPolygonWithTolerance(PushChordTolerance);
|
||||
polygon.RemoveSelfIntersections();
|
||||
polygon.Offset(part.Location);
|
||||
lines.AddRange(GetDirectionalLines(polygon, facingDirection));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user