fix: DetermineWinding used absolute area, always returned CCW

Shape.Area() returns Math.Abs(signedArea), so DetermineWinding always
detected CCW regardless of actual winding. Use ToPolygon().RotationDirection()
which uses the signed area correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-02 12:16:15 -04:00
parent 64945220b9
commit 5bcad9667b

View File

@@ -186,9 +186,10 @@ namespace OpenNest.CNC.CuttingStrategy
public static RotationType DetermineWinding(Shape shape)
{
// Use signed area: positive = CCW, negative = CW
var area = shape.Area();
return area >= 0 ? RotationType.CCW : RotationType.CW;
if (shape.Entities.Count == 1 && shape.Entities[0] is Circle circle)
return circle.Rotation;
return shape.ToPolygon().RotationDirection();
}
private LeadIn ClampLeadInForCircle(LeadIn leadIn, Circle circle, Vector contourPoint, double normalAngle)