Add Circle.get_point_from_angle, and arc_center config variable for arc

This commit is contained in:
Grant Sanderson 2019-01-17 14:10:52 -08:00
parent 8820d4b339
commit e2e6fad114

View file

@ -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 = {