Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Fix bug in `Circle.point_at_angle` when angle not in [0, 2 * pi]. (#2613)

Kian Crossef00ae5e6689
diff --git a/manim/mobject/geometry/arc.py b/manim/mobject/geometry/arc.py
index bfc704f52..a15debefe 100644
--- a/manim/mobject/geometry/arc.py
+++ b/manim/mobject/geometry/arc.py
@@ -575,7 +575,9 @@ class Circle(Arc):
"""
start_angle = angle_of_vector(self.points[0] - self.get_center())
- return self.point_from_proportion((angle - start_angle) / TAU)
+ proportion = (angle - start_angle) / TAU
+ proportion -= math.floor(proportion)
+ return self.point_from_proportion(proportion)
@staticmethod
def from_three_points(
diff --git a/tests/test_vectorized_mobject.py b/tests/test_vectorized_mobject.py
index 5da5c3ac1..b6013c92f 100644
--- a/tests/test_vectorized_mobject.py
+++ b/tests/test_vectorized_mobject.py
@@ -289,3 +289,9 @@ def test_vmobject_different_num_points_and_submobjects_become():
a.become(b)
assert np.array_equal(a.points, b.points)
assert len(a.submobjects) == len(b.submobjects)
+
+
+def test_vmobject_point_at_angle():
+ a = Circle()
+ p = a.point_at_angle(4 * PI)
+ assert np.array_equal(a.points[0], p)