Skip to content

Commit cc87ca4

Browse files
authored
Merge pull request #482 from AkashKarnatak/master
Fixed "get_arc_center()" method of Arc class
2 parents dc4504c + 79e58dd commit cc87ca4

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

manim/mobject/geometry.py

Lines changed: 6 additions & 0 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

tests/test_unit_geometry.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import pytest
2+
import numpy as np
3+
from manim import Sector
4+
5+
6+
def test_get_arc_center():
7+
assert np.all(Sector(arc_center=[1, 2, 0]).get_arc_center() == [1, 2, 0])

0 commit comments

Comments
 (0)