mirror of
https://github.com/3b1b/manim.git
synced 2025-08-21 05:44:04 +00:00
Remove arrow tips
This commit is contained in:
parent
72f0af0fbf
commit
b39965fe30
1 changed files with 9 additions and 0 deletions
|
@ -106,6 +106,7 @@ class Arrow(Line):
|
||||||
self.add_tip()
|
self.add_tip()
|
||||||
|
|
||||||
def add_tip(self):
|
def add_tip(self):
|
||||||
|
num_points = self.get_num_points()
|
||||||
vect = self.start-self.end
|
vect = self.start-self.end
|
||||||
vect = vect*self.tip_length/np.linalg.norm(vect)
|
vect = vect*self.tip_length/np.linalg.norm(vect)
|
||||||
self.add_points([
|
self.add_points([
|
||||||
|
@ -116,6 +117,14 @@ class Arrow(Line):
|
||||||
for axis in IN, OUT
|
for axis in IN, OUT
|
||||||
]
|
]
|
||||||
])
|
])
|
||||||
|
self.num_tip_points = self.get_num_points()-num_points
|
||||||
|
|
||||||
|
def remove_tip(self):
|
||||||
|
if not hasattr(self, "num_tip_points"):
|
||||||
|
return self
|
||||||
|
for attr in "points", "rgbs":
|
||||||
|
setattr(self, attr, getattr(self, attr)[:-self.num_tip_points])
|
||||||
|
return self
|
||||||
|
|
||||||
class CurvedLine(Line):
|
class CurvedLine(Line):
|
||||||
def __init__(self, start, end, via = None, **kwargs):
|
def __init__(self, start, end, via = None, **kwargs):
|
||||||
|
|
Loading…
Add table
Reference in a new issue