From 5bcad9667b16ae5cffe09e56002c94f8457f5453 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Thu, 2 Apr 2026 12:16:15 -0400 Subject: [PATCH] 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) --- .../CNC/CuttingStrategy/ContourCuttingStrategy.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/OpenNest.Core/CNC/CuttingStrategy/ContourCuttingStrategy.cs b/OpenNest.Core/CNC/CuttingStrategy/ContourCuttingStrategy.cs index 580add9..813e1ad 100644 --- a/OpenNest.Core/CNC/CuttingStrategy/ContourCuttingStrategy.cs +++ b/OpenNest.Core/CNC/CuttingStrategy/ContourCuttingStrategy.cs @@ -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)