mirror of
https://github.com/3b1b/manim.git
synced 2025-08-01 17:29:06 +08:00
apply_matrix for Mobject
This commit is contained in:
@ -162,6 +162,12 @@ class Mobject(object):
|
|||||||
mob.points = np.apply_along_axis(function, 1, mob.points)
|
mob.points = np.apply_along_axis(function, 1, mob.points)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
def apply_matrix(self, matrix):
|
||||||
|
matrix = np.array(matrix)
|
||||||
|
for mob in self.family_members_with_points():
|
||||||
|
mob.points = np.dot(mob.points, matrix.T)
|
||||||
|
return self
|
||||||
|
|
||||||
def wag(self, direction = RIGHT, axis = DOWN, wag_factor = 1.0):
|
def wag(self, direction = RIGHT, axis = DOWN, wag_factor = 1.0):
|
||||||
for mob in self.family_members_with_points():
|
for mob in self.family_members_with_points():
|
||||||
alphas = np.dot(mob.points, np.transpose(axis))
|
alphas = np.dot(mob.points, np.transpose(axis))
|
||||||
@ -706,8 +712,6 @@ class Mobject(object):
|
|||||||
def pointwise_become_partial(self, mobject, a, b):
|
def pointwise_become_partial(self, mobject, a, b):
|
||||||
pass #To implement in subclass
|
pass #To implement in subclass
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Group(Mobject):
|
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
|
||||||
|
Reference in New Issue
Block a user