mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Add Circle.get_point_from_angle, and arc_center config variable for arc
This commit is contained in:
parent
8820d4b339
commit
e2e6fad114
1 changed files with 10 additions and 0 deletions
|
@ -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 = {
|
||||
|
|
Loading…
Add table
Reference in a new issue