From c8c63a4099b3e30763c253980d3241f090a5255b Mon Sep 17 00:00:00 2001 From: Stephen Green Date: Sun, 25 May 2025 22:12:13 -0400 Subject: [PATCH] Fix for https://github.com/FreeCAD/FreeCAD/issues/21533 --- src/Mod/CAM/Path/Dressup/Gui/Dragknife.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py b/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py index 30cdc09854..d553b4d682 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py @@ -149,16 +149,17 @@ class ObjectDressup: return myAngle def getIncidentAngle(self, queue): - # '''returns in the incident angle in radians between the current and previous moves''' + # '''returns in the incident angle in degrees between the current and previous moves''' angleatend = float(math.degrees(self.segmentAngleXY(queue[2], queue[1], True))) - if angleatend < 0: - angleatend = 360 + angleatend angleatstart = float(math.degrees(self.segmentAngleXY(queue[1], queue[0]))) - if angleatstart < 0: - angleatstart = 360 + angleatstart - incident_angle = angleatend - angleatstart + incident_angle = (angleatstart - angleatend + 360) % 360 + + # The incident can never be greater than 180 degrees. If it is + # then we need to measure the other way around the circle. + if incident_angle > 180: + incident_angle = 360 - incident_angle return incident_angle