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