From f1c0a341cc21eaac19b46f292ba754eaec5ecc54 Mon Sep 17 00:00:00 2001 From: Grant Sanderson Date: Thu, 24 Aug 2017 19:06:02 -0700 Subject: [PATCH] apply_matrix for Mobject --- mobject/mobject.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mobject/mobject.py b/mobject/mobject.py index c9f824d0..39544327 100644 --- a/mobject/mobject.py +++ b/mobject/mobject.py @@ -162,6 +162,12 @@ class Mobject(object): mob.points = np.apply_along_axis(function, 1, mob.points) 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): for mob in self.family_members_with_points(): alphas = np.dot(mob.points, np.transpose(axis)) @@ -706,8 +712,6 @@ class Mobject(object): def pointwise_become_partial(self, mobject, a, b): pass #To implement in subclass - - class Group(Mobject): #Alternate name to improve readibility in cases where #the mobject is used primarily for its submobject housing