From 7c58cfa74980fcd8f40984a25edce5935ca7ca50 Mon Sep 17 00:00:00 2001 From: AJ Isaacs Date: Tue, 31 Mar 2026 09:01:18 -0400 Subject: [PATCH] fix: correct lead-in approach angle formula mirroring pierce point MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The offset direction (start→pierce) is reversed from the approach direction (pierce→start), so the old formula produced 180°−angle instead of the requested angle. Invisible at the 90° default but caused 45° to render as 135°. Co-Authored-By: Claude Opus 4.6 (1M context) --- OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLeadIn.cs | 2 +- OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLineLeadIn.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLeadIn.cs b/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLeadIn.cs index cfea720..c87caef 100644 --- a/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLeadIn.cs +++ b/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLeadIn.cs @@ -23,7 +23,7 @@ namespace OpenNest.CNC.CuttingStrategy public override Vector GetPiercePoint(Vector contourStartPoint, double contourNormalAngle) { - var approachAngle = contourNormalAngle + Angle.HalfPI - Angle.ToRadians(ApproachAngle); + var approachAngle = contourNormalAngle - Angle.HalfPI + Angle.ToRadians(ApproachAngle); return new Vector( contourStartPoint.X + Length * System.Math.Cos(approachAngle), contourStartPoint.Y + Length * System.Math.Sin(approachAngle)); diff --git a/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLineLeadIn.cs b/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLineLeadIn.cs index 3125876..8db3b2c 100644 --- a/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLineLeadIn.cs +++ b/OpenNest.Core/CNC/CuttingStrategy/LeadIns/LineLineLeadIn.cs @@ -16,7 +16,7 @@ namespace OpenNest.CNC.CuttingStrategy { var piercePoint = GetPiercePoint(contourStartPoint, contourNormalAngle); - var secondAngle = contourNormalAngle + Angle.HalfPI - Angle.ToRadians(ApproachAngle1); + var secondAngle = contourNormalAngle - Angle.HalfPI + Angle.ToRadians(ApproachAngle1); var midPoint = new Vector( contourStartPoint.X + Length2 * System.Math.Cos(secondAngle), contourStartPoint.Y + Length2 * System.Math.Sin(secondAngle)); @@ -31,7 +31,7 @@ namespace OpenNest.CNC.CuttingStrategy public override Vector GetPiercePoint(Vector contourStartPoint, double contourNormalAngle) { - var secondAngle = contourNormalAngle + Angle.HalfPI - Angle.ToRadians(ApproachAngle1); + var secondAngle = contourNormalAngle - Angle.HalfPI + Angle.ToRadians(ApproachAngle1); var midX = contourStartPoint.X + Length2 * System.Math.Cos(secondAngle); var midY = contourStartPoint.Y + Length2 * System.Math.Sin(secondAngle);