mirror of
https://github.com/3b1b/manim.git
synced 2025-08-01 17:29:06 +08:00
Arcs can now have arrows on both sides
This commit is contained in:
@ -36,18 +36,32 @@ class Arc(VMobject):
|
|||||||
)
|
)
|
||||||
self.scale(self.radius, about_point = ORIGIN)
|
self.scale(self.radius, about_point = ORIGIN)
|
||||||
|
|
||||||
def add_tip(self, tip_length = 0.25, end = 0):
|
def add_tip(self, tip_length = 0.25, at_start = False, at_end = True):
|
||||||
#TODO, do this a better way
|
#TODO, do this a better way
|
||||||
if end == 1:
|
p1 = p2 = p3 = p4 = None
|
||||||
|
start_arrow = end_arrow = None
|
||||||
|
if at_start:
|
||||||
p1, p2 = self.points[-2:]
|
p1, p2 = self.points[-2:]
|
||||||
else:
|
start_arrow = Arrow(
|
||||||
p2, p1 = self.points[:2]
|
p1, 2*p2 - p1,
|
||||||
arrow = Arrow(
|
tip_length = tip_length,
|
||||||
p1, 2*p2 - p1,
|
max_tip_length_to_length_ratio = 2.0
|
||||||
tip_length = tip_length,
|
)
|
||||||
max_tip_length_to_length_ratio = 2.0
|
self.add(start_arrow.split()[-1])
|
||||||
)
|
|
||||||
self.add(arrow.split()[-1])
|
if at_end:
|
||||||
|
p4, p3 = self.points[:2]
|
||||||
|
end_arrow = Arrow(
|
||||||
|
p3, 2*p4 - p3,
|
||||||
|
tip_length = tip_length,
|
||||||
|
max_tip_length_to_length_ratio = 2.0
|
||||||
|
)
|
||||||
|
self.add(end_arrow.split()[-1])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.highlight(self.get_color())
|
self.highlight(self.get_color())
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user