mirror of
https://github.com/3b1b/manim.git
synced 2025-07-31 14:03:59 +08:00
Small fixes to matrix.py
This commit is contained in:
@ -72,9 +72,7 @@ class Matrix(VMobject):
|
||||
or mobjects
|
||||
"""
|
||||
VMobject.__init__(self, **kwargs)
|
||||
matrix = np.array(matrix)
|
||||
if matrix.ndim == 1:
|
||||
matrix = matrix.reshape((matrix.size, 1))
|
||||
matrix = np.array(matrix, ndmin=1)
|
||||
mob_matrix = self.matrix_to_mob_matrix(matrix)
|
||||
self.organize_mob_matrix(mob_matrix)
|
||||
self.elements = VGroup(*mob_matrix.flatten())
|
||||
@ -89,11 +87,9 @@ class Matrix(VMobject):
|
||||
self.add_background_rectangle()
|
||||
|
||||
def matrix_to_mob_matrix(self, matrix):
|
||||
return np.vectorize(
|
||||
lambda e: self.element_to_mobject(
|
||||
e, **self.element_to_mobject_config
|
||||
)
|
||||
)(matrix)
|
||||
return np.vectorize(self.element_to_mobject)(
|
||||
matrix
|
||||
)
|
||||
|
||||
def organize_mob_matrix(self, matrix):
|
||||
for i, row in enumerate(matrix):
|
||||
|
Reference in New Issue
Block a user