diff --git a/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py b/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py index cada0a52f3..39db85c209 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