Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Add Circle.get_point_from_angle, and arc_center config variable for arc

Grant Sandersone2e6fad1140b
diff --git a/manimlib/mobject/geometry.py b/manimlib/mobject/geometry.py
index eba3f0010..093118d91 100644
--- a/manimlib/mobject/geometry.py
+++ b/manimlib/mobject/geometry.py
@@ -23,6 +23,7 @@ class Arc(VMobject):
"start_angle": 0,
"num_anchors": 9,
"anchors_span_full_range": True,
+ "arc_center": ORIGIN,
}
def __init__(self, angle, **kwargs):
@@ -50,6 +51,7 @@ class Arc(VMobject):
anchors, handles1, handles2
)
self.scale(self.radius, about_point=ORIGIN)
+ self.shift(self.arc_center)
def add_tip(self, tip_length=0.25, at_start=False, at_end=True):
# clear out any old tips
@@ -180,6 +182,14 @@ class Circle(Arc):
np.sqrt(mobject.get_width()**2 + mobject.get_height()**2))
self.scale(buffer_factor)
+ def get_point_from_angle(self, angle):
+ start_angle = angle_of_vector(
+ self.points[0] - self.get_center()
+ )
+ return self.point_from_proportion(
+ (angle - start_angle) / TAU
+ )
+
class Dot(Circle):
CONFIG = {