mirror of
https://github.com/ManimCommunity/manim.git
synced 2026-06-22 10:01:47 +00:00
Fix bug in Circle.point_at_angle when angle not in [0, 2 * pi]. (#2613)
When the angle passed to `Circle.point_at_angle` is not in the interval [0, 2 * pi], an error is thrown. This commit maps all angles into the interval [0, 2 * pi].
This commit is contained in:
parent
0bc593a8a0
commit
ef00ae5e66
2 changed files with 9 additions and 1 deletions
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue