mirror of
https://github.com/3b1b/manim.git
synced 2025-08-01 17:29:06 +08:00
Deleted the cast error in class TOP
This commit is contained in:
@ -103,7 +103,7 @@ class Mobject(object):
|
|||||||
submob.copy() for submob in self.submobjects
|
submob.copy() for submob in self.submobjects
|
||||||
]
|
]
|
||||||
return copy_mobject
|
return copy_mobject
|
||||||
|
|
||||||
def deepcopy(self):
|
def deepcopy(self):
|
||||||
return copy.deepcopy(self)
|
return copy.deepcopy(self)
|
||||||
|
|
||||||
@ -120,9 +120,10 @@ class Mobject(object):
|
|||||||
|
|
||||||
def shift(self, *vectors):
|
def shift(self, *vectors):
|
||||||
total_vector = reduce(op.add, vectors)
|
total_vector = reduce(op.add, vectors)
|
||||||
for mob in self.family_members_with_points():
|
for mob in self.family_members_with_points():
|
||||||
|
mob.points = mob.points.astype('float')
|
||||||
mob.points += total_vector
|
mob.points += total_vector
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
||||||
def scale(self, scale_factor, about_point = None):
|
def scale(self, scale_factor, about_point = None):
|
||||||
@ -248,8 +249,8 @@ class Mobject(object):
|
|||||||
def to_edge(self, edge = LEFT, buff = DEFAULT_MOBJECT_TO_EDGE_BUFFER):
|
def to_edge(self, edge = LEFT, buff = DEFAULT_MOBJECT_TO_EDGE_BUFFER):
|
||||||
return self.align_on_border(edge, buff)
|
return self.align_on_border(edge, buff)
|
||||||
|
|
||||||
def next_to(self, mobject_or_point,
|
def next_to(self, mobject_or_point,
|
||||||
direction = RIGHT,
|
direction = RIGHT,
|
||||||
buff = DEFAULT_MOBJECT_TO_MOBJECT_BUFFER,
|
buff = DEFAULT_MOBJECT_TO_MOBJECT_BUFFER,
|
||||||
aligned_edge = ORIGIN,
|
aligned_edge = ORIGIN,
|
||||||
align_using_submobjects = False,
|
align_using_submobjects = False,
|
||||||
@ -347,7 +348,7 @@ class Mobject(object):
|
|||||||
else:
|
else:
|
||||||
self.rescale_to_fit(
|
self.rescale_to_fit(
|
||||||
mobject.length_over_dim(dim_to_match),
|
mobject.length_over_dim(dim_to_match),
|
||||||
dim_to_match,
|
dim_to_match,
|
||||||
stretch = False
|
stretch = False
|
||||||
)
|
)
|
||||||
self.shift(mobject.get_center() - self.get_center())
|
self.shift(mobject.get_center() - self.get_center())
|
||||||
@ -528,7 +529,7 @@ class Mobject(object):
|
|||||||
|
|
||||||
def length_over_dim(self, dim):
|
def length_over_dim(self, dim):
|
||||||
return (
|
return (
|
||||||
self.reduce_across_dimension(np.max, np.max, dim) -
|
self.reduce_across_dimension(np.max, np.max, dim) -
|
||||||
self.reduce_across_dimension(np.min, np.min, dim)
|
self.reduce_across_dimension(np.min, np.min, dim)
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -564,7 +565,7 @@ class Mobject(object):
|
|||||||
|
|
||||||
def family_members_with_points(self):
|
def family_members_with_points(self):
|
||||||
return filter(
|
return filter(
|
||||||
lambda m : m.get_num_points() > 0,
|
lambda m : m.get_num_points() > 0,
|
||||||
self.submobject_family()
|
self.submobject_family()
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -584,7 +585,7 @@ class Mobject(object):
|
|||||||
)
|
)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
## Alignment
|
## Alignment
|
||||||
def align_data(self, mobject):
|
def align_data(self, mobject):
|
||||||
self.align_submobjects(mobject)
|
self.align_submobjects(mobject)
|
||||||
self.align_points(mobject)
|
self.align_points(mobject)
|
||||||
@ -634,7 +635,7 @@ class Mobject(object):
|
|||||||
|
|
||||||
def null_point_align(self, mobject):
|
def null_point_align(self, mobject):
|
||||||
"""
|
"""
|
||||||
If self has no points, but needs to align
|
If self has no points, but needs to align
|
||||||
with mobject, which has points
|
with mobject, which has points
|
||||||
"""
|
"""
|
||||||
if self.submobjects:
|
if self.submobjects:
|
||||||
@ -670,10 +671,10 @@ class Mobject(object):
|
|||||||
def repeat_submobject(self, submob):
|
def repeat_submobject(self, submob):
|
||||||
return submob.copy()
|
return submob.copy()
|
||||||
|
|
||||||
def interpolate(self, mobject1, mobject2,
|
def interpolate(self, mobject1, mobject2,
|
||||||
alpha, path_func = straight_path):
|
alpha, path_func = straight_path):
|
||||||
"""
|
"""
|
||||||
Turns self into an interpolation between mobject1
|
Turns self into an interpolation between mobject1
|
||||||
and mobject2.
|
and mobject2.
|
||||||
"""
|
"""
|
||||||
self.points = path_func(
|
self.points = path_func(
|
||||||
@ -687,7 +688,7 @@ class Mobject(object):
|
|||||||
def become_partial(self, mobject, a, b):
|
def become_partial(self, mobject, a, b):
|
||||||
"""
|
"""
|
||||||
Set points in such a way as to become only
|
Set points in such a way as to become only
|
||||||
part of mobject.
|
part of mobject.
|
||||||
Inputs 0 <= a < b <= 1 determine what portion
|
Inputs 0 <= a < b <= 1 determine what portion
|
||||||
of mobject to become.
|
of mobject to become.
|
||||||
"""
|
"""
|
||||||
@ -704,17 +705,4 @@ class Group(Mobject):
|
|||||||
#Alternate name to improve readibility in cases where
|
#Alternate name to improve readibility in cases where
|
||||||
#the mobject is used primarily for its submobject housing
|
#the mobject is used primarily for its submobject housing
|
||||||
#functionality.
|
#functionality.
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user