Skip to content

Commit

Permalink
Revert "Corrected calculation of arc length"
Browse files Browse the repository at this point in the history
This reverts commit eadbae2.
  • Loading branch information
JackB-Ansys committed Jul 15, 2024
1 parent eadbae2 commit 49636c1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/ansys/motorcad/core/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,19 @@ def length(self):
float
Length of arc
"""
return abs(self.radius * radians(self.total_angle))
radius, angle_1 = xy_to_rt(self.start.x, self.start.y)
radius, angle_2 = xy_to_rt(self.end.x, self.end.y)

if self.radius == 0:
arc_angle = 0
elif ((self.radius > 0) and (angle_1 > angle_2)) or (
(self.radius < 0) and angle_2 < angle_1
):
arc_angle = angle_2 - (angle_1 - 360)
else:
arc_angle = angle_2 - angle_1

return self.radius * radians(arc_angle)

def reverse(self):
"""Reverse Arc entity."""
Expand Down

0 comments on commit 49636c1

Please sign in to comment.