Skip to content

Commit 76690d0

Browse files
committed
Fixed "get_arc_center()" method of Arc class.
Now it works for arc with zero radius as well.
1 parent a5d15a0 commit 76690d0

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

manim/mobject/geometry.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,12 @@ def get_arc_center(self, warning=True):
288288
"""
289289
# First two anchors and handles
290290
a1, h1, h2, a2 = self.points[:4]
291+
292+
if np.all(a1 == a2):
293+
# For a1 and a2 to lie at the same point arc radius
294+
# must be zero. Thus arc_center will also lie at
295+
# that point.
296+
return a1
291297
# Tangent vectors
292298
t1 = h1 - a1
293299
t2 = h2 - a2
@@ -439,11 +445,11 @@ def generate_points(self):
439445
)
440446
for radius in (self.inner_radius, self.outer_radius)
441447
]
442-
inner_arc.reverse_points()
443-
self.append_points(outer_arc.points)
444-
self.add_line_to(inner_arc.points[0])
448+
outer_arc.reverse_points()
445449
self.append_points(inner_arc.points)
446450
self.add_line_to(outer_arc.points[0])
451+
self.append_points(outer_arc.points)
452+
self.add_line_to(inner_arc.points[0])
447453

448454

449455
class Sector(AnnularSector):

0 commit comments

Comments
 (0)