mirror of
https://github.com/3b1b/manim.git
synced 2025-08-02 19:46:21 +08:00
Remove usage of np.append
This commit is contained in:
@ -653,7 +653,7 @@ class Vector(Arrow):
|
||||
|
||||
def __init__(self, direction=RIGHT, **kwargs):
|
||||
if len(direction) == 2:
|
||||
direction = np.append(np.array(direction), 0)
|
||||
direction = np.hstack([direction, 0])
|
||||
Arrow.__init__(self, ORIGIN, direction, **kwargs)
|
||||
|
||||
|
||||
|
@ -346,10 +346,7 @@ class Mobject(Container):
|
||||
This can make transition animations nicer
|
||||
"""
|
||||
def repeat_array(array):
|
||||
return reduce(
|
||||
lambda a1, a2: np.append(a1, a2, axis=0),
|
||||
[array] * count
|
||||
)
|
||||
return np.vstack([array] * count)
|
||||
for mob in self.family_members_with_points():
|
||||
mob.apply_over_attr_arrays(repeat_array)
|
||||
return self
|
||||
|
@ -27,7 +27,7 @@ class PMobject(Mobject):
|
||||
if not isinstance(points, np.ndarray):
|
||||
points = np.array(points)
|
||||
num_new_points = len(points)
|
||||
self.points = np.append(self.points, points, axis=0)
|
||||
self.points = np.vstack([self.points, points])
|
||||
if rgbas is None:
|
||||
color = Color(color) if color else self.color
|
||||
rgbas = np.repeat(
|
||||
@ -37,7 +37,7 @@ class PMobject(Mobject):
|
||||
)
|
||||
elif len(rgbas) != len(points):
|
||||
raise Exception("points and rgbas must have same shape")
|
||||
self.rgbas = np.append(self.rgbas, rgbas, axis=0)
|
||||
self.rgbas = np.vstack([self.rgbas, rgbas])
|
||||
return self
|
||||
|
||||
def set_color(self, color=YELLOW_C, family=True):
|
||||
|
Reference in New Issue
Block a user