mirror of
https://github.com/3b1b/manim.git
synced 2025-08-05 16:49:03 +00:00
Rename set_color_columns
This commit is contained in:
parent
d184c5fc9e
commit
45d3806b86
16 changed files with 87 additions and 77 deletions
|
@ -1209,7 +1209,7 @@ class SolvingASystemWithOrthonormalMatrix(LinearTransformationScene):
|
|||
height=1.25,
|
||||
)
|
||||
system.to_corner(UL)
|
||||
system.matrix_mobject.set_color_columns(X_COLOR, Y_COLOR)
|
||||
system.matrix_mobject.set_column_colors(X_COLOR, Y_COLOR)
|
||||
system.input_vect_mob.elements.set_color(WHITE)
|
||||
system_rect = BackgroundRectangle(system, buff=MED_SMALL_BUFF)
|
||||
|
||||
|
@ -1590,7 +1590,7 @@ class TransformingAreasYCoord(LinearTransformationScene):
|
|||
apply_words = TextMobject("Apply")
|
||||
apply_words.add_background_rectangle()
|
||||
matrix_mobject = IntegerMatrix(self.matrix)
|
||||
matrix_mobject.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix_mobject.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix_mobject.add_background_rectangle()
|
||||
matrix_mobject.next_to(apply_words, RIGHT)
|
||||
matrix_brace = Brace(matrix_mobject, DOWN, buff=SMALL_BUFF)
|
||||
|
@ -1773,7 +1773,7 @@ class TransformingAreasYCoord(LinearTransformationScene):
|
|||
denom_det_text = get_det_text(matrix_mobject_copy)
|
||||
top_matrix_mobject = IntegerMatrix(new_matrix)
|
||||
top_matrix_mobject.set_height(frac_matrix_height)
|
||||
top_matrix_mobject.set_color_columns(X_COLOR, Y_COLOR)
|
||||
top_matrix_mobject.set_column_colors(X_COLOR, Y_COLOR)
|
||||
VGroup(*top_matrix_mobject.mob_matrix[:, self.index]).set_color(MAROON_B)
|
||||
top_matrix_mobject.add_background_rectangle()
|
||||
num_det_text = get_det_text(top_matrix_mobject)
|
||||
|
@ -1986,7 +1986,7 @@ class ThreeDCoordinatesAsVolumes(Scene):
|
|||
x, y, z = coords = VGroup(*list(map(TexMobject, "xyz")))
|
||||
coords.set_color_by_gradient(*colors)
|
||||
matrix = IntegerMatrix(np.identity(3))
|
||||
matrix.set_color_columns(*colors)
|
||||
matrix.set_column_colors(*colors)
|
||||
det_text = get_det_text(matrix)
|
||||
equals = TexMobject("=")
|
||||
equals.next_to(det_text[0], LEFT)
|
||||
|
|
|
@ -735,8 +735,8 @@ class Square(Rectangle):
|
|||
|
||||
class RoundedRectangle(Rectangle):
|
||||
CONFIG = {
|
||||
"corner_radius" : 0.5,
|
||||
"close_new_points" : True
|
||||
"corner_radius": 0.5,
|
||||
"close_new_points": True
|
||||
}
|
||||
|
||||
def generate_points(self):
|
||||
|
|
|
@ -112,9 +112,16 @@ class Matrix(VMobject):
|
|||
self.brackets = VGroup(l_bracket, r_bracket)
|
||||
return self
|
||||
|
||||
def set_color_columns(self, *colors):
|
||||
for i, color in enumerate(colors):
|
||||
VGroup(*self.mob_matrix[:, i]).set_color(color)
|
||||
def get_columns(self):
|
||||
return VGroup(*[
|
||||
VGroup(*self.mob_matrix[:, i])
|
||||
for i in range(self.mob_matrix.shape[1])
|
||||
])
|
||||
|
||||
def set_column_colors(self, *colors):
|
||||
columns = self.get_columns()
|
||||
for color, column in zip(colors, columns):
|
||||
column.set_color(color)
|
||||
return self
|
||||
|
||||
def add_background_to_entries(self):
|
||||
|
|
|
@ -41,8 +41,9 @@ class SVGMobject(VMobject):
|
|||
"propagate_style_to_family": True,
|
||||
}
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
digest_config(self, kwargs, locals())
|
||||
def __init__(self, file_name=None, **kwargs):
|
||||
digest_config(self, kwargs)
|
||||
self.file_name = self.file_name or file_name
|
||||
self.ensure_valid_file()
|
||||
VMobject.__init__(self, **kwargs)
|
||||
self.move_into_position()
|
||||
|
|
|
@ -308,9 +308,11 @@ class VMobject(Mobject):
|
|||
self.color_using_background_image(vmobject.get_background_image_file())
|
||||
return self
|
||||
|
||||
def set_shade_in_3d(self, value=True):
|
||||
def set_shade_in_3d(self, value=True, z_index_as_group=False):
|
||||
for submob in self.get_family():
|
||||
submob.shade_in_3d = value
|
||||
if z_index_as_group:
|
||||
submob.z_index_group = self
|
||||
|
||||
# Drawing
|
||||
def start_at(self, point):
|
||||
|
|
|
@ -145,7 +145,7 @@ class ExampleTranformationScene(LinearTransformationScene):
|
|||
|
||||
def add_matrix(self):
|
||||
matrix = Matrix(self.t_matrix.T)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.next_to(ORIGIN, LEFT, buff = MED_SMALL_BUFF)
|
||||
matrix.to_edge(UP)
|
||||
matrix.rect = BackgroundRectangle(matrix)
|
||||
|
@ -492,7 +492,7 @@ class EigenvalueNegativeOneHalf(LinearTransformationScene):
|
|||
def construct(self):
|
||||
matrix = Matrix(self.t_matrix.T)
|
||||
matrix.add_to_back(BackgroundRectangle(matrix))
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.next_to(ORIGIN, LEFT)
|
||||
matrix.to_edge(UP)
|
||||
self.add_foreground_mobject(matrix)
|
||||
|
@ -1506,7 +1506,7 @@ class Rotate90Degrees(LinearTransformationScene):
|
|||
def setup(self):
|
||||
LinearTransformationScene.setup(self)
|
||||
matrix = Matrix(self.t_matrix.T)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.next_to(ORIGIN, LEFT)
|
||||
matrix.to_edge(UP)
|
||||
matrix.rect = BackgroundRectangle(matrix)
|
||||
|
@ -1766,7 +1766,7 @@ class ScalingExample(LinearTransformationScene):
|
|||
}
|
||||
def construct(self):
|
||||
matrix = Matrix(self.t_matrix.T)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.add_to_back(BackgroundRectangle(matrix))
|
||||
matrix.next_to(ORIGIN, LEFT)
|
||||
matrix.to_edge(UP)
|
||||
|
@ -1815,7 +1815,7 @@ class BasisVectorsAreEigenvectors(LinearTransformationScene):
|
|||
}
|
||||
def construct(self):
|
||||
matrix = Matrix(self.t_matrix.T)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.next_to(ORIGIN, LEFT)
|
||||
matrix.to_edge(UP)
|
||||
|
||||
|
@ -1916,7 +1916,7 @@ class DefineDiagonalMatrix(Scene):
|
|||
self.play(Write(title))
|
||||
self.wait()
|
||||
self.play(
|
||||
matrix.set_color_columns,
|
||||
matrix.set_column_colors,
|
||||
X_COLOR, Y_COLOR, Z_COLOR, YELLOW
|
||||
)
|
||||
self.wait()
|
||||
|
@ -1989,7 +1989,7 @@ class RepeatedMultiplicationInAction(Scene):
|
|||
|
||||
def get_matrix(self, vector):
|
||||
matrix = Matrix([[3, 0], [0, 2]])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.next_to(vector, LEFT)
|
||||
scalars = [matrix.get_mob_matrix()[i, i] for i in range(2)]
|
||||
matrix.remove(*scalars)
|
||||
|
@ -2004,7 +2004,7 @@ class RepeatedMultilpicationOfMatrices(Scene):
|
|||
vector = Matrix(["x", "y"])
|
||||
vector.set_color(YELLOW)
|
||||
matrix = Matrix(self.matrix)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrices = VGroup(*[
|
||||
matrix.copy(),
|
||||
TexMobject("\\dots\\dots"),
|
||||
|
|
|
@ -1722,7 +1722,7 @@ class IntroducePolynomialSpace(Scene):
|
|||
last_col.arrange_submobjects(DOWN, buff = 0.83)
|
||||
last_col.move_to(last_col_top, aligned_edge = UP+RIGHT)
|
||||
##End horrible
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR, Z_COLOR, MAROON_B)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR, Z_COLOR, MAROON_B)
|
||||
|
||||
deriv = TexMobject("\\dfrac{d}{dx}")
|
||||
equals = TexMobject("=")
|
||||
|
@ -1870,8 +1870,8 @@ class IntroducePolynomialSpace(Scene):
|
|||
class MatrixVectorMultiplicationAndDerivative(TeacherStudentsScene):
|
||||
def construct(self):
|
||||
mv_mult = VGroup(
|
||||
Matrix([[3, 1], [0, 2]]).set_color_columns(X_COLOR, Y_COLOR),
|
||||
Matrix(["x", "y"]).set_color_columns(YELLOW)
|
||||
Matrix([[3, 1], [0, 2]]).set_column_colors(X_COLOR, Y_COLOR),
|
||||
Matrix(["x", "y"]).set_column_colors(YELLOW)
|
||||
)
|
||||
mv_mult.arrange_submobjects()
|
||||
mv_mult.scale(0.75)
|
||||
|
|
|
@ -394,7 +394,7 @@ class ExplainWhyItsMatrixMultiplication(Scene):
|
|||
equals = TexMobject("=").next_to(long_way, RIGHT)
|
||||
|
||||
comp_matrix = Matrix([[1, -1], [1, 0]])
|
||||
comp_matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
comp_matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
vect_copy = vect.copy()
|
||||
short_way = VMobject(comp_matrix, vect_copy)
|
||||
short_way.arrange_submobjects(buff = 0.1)
|
||||
|
|
|
@ -154,7 +154,7 @@ class DiagonalExample(LinearTransformationScene):
|
|||
def construct(self):
|
||||
self.setup()
|
||||
matrix = Matrix(np.array(self.transposed_matrix).transpose())
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.next_to(ORIGIN, LEFT).to_edge(UP)
|
||||
matrix_background = BackgroundRectangle(matrix)
|
||||
self.play(ShowCreation(matrix_background), Write(matrix))
|
||||
|
@ -366,7 +366,7 @@ class NameDeterminant(LinearTransformationScene):
|
|||
|
||||
def get_matrix(self):
|
||||
matrix = Matrix(np.array(self.t_matrix).transpose())
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.next_to(self.title, DOWN, buff = 0.5)
|
||||
matrix.shift(2*LEFT)
|
||||
matrix_background = BackgroundRectangle(matrix)
|
||||
|
@ -446,7 +446,7 @@ class NegativeDeterminant(Scene):
|
|||
def construct(self):
|
||||
numerical_matrix = [[1, 2], [3, 4]]
|
||||
matrix = Matrix(numerical_matrix)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
det_text = get_det_text(matrix, np.linalg.det(numerical_matrix))
|
||||
words = TextMobject("""
|
||||
How can you scale area
|
||||
|
@ -602,7 +602,7 @@ class WriteNegativeDeterminant(NegativeDeterminantTransformation):
|
|||
matrix = Matrix(np.array(self.t_matrix).transpose())
|
||||
matrix.next_to(ORIGIN, LEFT)
|
||||
matrix.to_edge(UP)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
|
||||
det_text = get_det_text(
|
||||
matrix, determinant = np.linalg.det(self.t_matrix)
|
||||
|
@ -720,7 +720,7 @@ class DeterminantIsVolumeOfParallelepiped(Scene):
|
|||
def construct(self):
|
||||
matrix = Matrix([[1, 0, 0.5], [0.5, 1, 0], [1, 0, 1]])
|
||||
matrix.shift(3*LEFT)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
det_text = get_det_text(matrix)
|
||||
eq = TexMobject("=")
|
||||
eq.next_to(det_text, RIGHT)
|
||||
|
@ -749,7 +749,7 @@ class WriteZeroDeterminant(Scene):
|
|||
def construct(self):
|
||||
matrix = Matrix([[1, 0, 1], [0.5, 1, 1.5], [1, 0, 1]])
|
||||
matrix.shift(2*LEFT)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
det_text = get_det_text(matrix, 0)
|
||||
brace = Brace(matrix, DOWN)
|
||||
words = TextMobject("""
|
||||
|
@ -842,7 +842,7 @@ class TwoDDeterminantFormula(Scene):
|
|||
def construct(self):
|
||||
eq = TextMobject("=")
|
||||
matrix = Matrix([["a", "b"], ["c", "d"]])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
ma, mb, mc, md = matrix.get_entries().split()
|
||||
ma.shift(0.1*DOWN)
|
||||
mc.shift(0.7*mc.get_height()*DOWN)
|
||||
|
@ -940,7 +940,7 @@ class FullFormulaExplanation(LinearTransformationScene):
|
|||
|
||||
def get_matrix(self):
|
||||
matrix = Matrix([["a", "b"], ["c", "d"]])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
ma, mb, mc, md = matrix.get_entries().split()
|
||||
ma.shift(0.1*DOWN)
|
||||
mc.shift(0.7*mc.get_height()*DOWN)
|
||||
|
@ -1027,13 +1027,13 @@ class FullFormulaExplanation(LinearTransformationScene):
|
|||
class ThreeDDetFormula(Scene):
|
||||
def construct(self):
|
||||
matrix = Matrix([list("abc"), list("def"), list("ghi")])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
m1 = Matrix([["e", "f"], ["h", "i"]])
|
||||
m1.set_color_columns(Y_COLOR, Z_COLOR)
|
||||
m1.set_column_colors(Y_COLOR, Z_COLOR)
|
||||
m2 = Matrix([["d", "f"], ["g", "i"]])
|
||||
m2.set_color_columns(X_COLOR, Z_COLOR)
|
||||
m2.set_column_colors(X_COLOR, Z_COLOR)
|
||||
m3 = Matrix([["d", "e"], ["g", "h"]])
|
||||
m3.set_color_columns(X_COLOR, Y_COLOR)
|
||||
m3.set_column_colors(X_COLOR, Y_COLOR)
|
||||
|
||||
for m in matrix, m1, m2, m3:
|
||||
m.add(get_det_text(m))
|
||||
|
|
|
@ -847,7 +847,7 @@ class MultiplyToIdentity(LinearTransformationScene):
|
|||
lhs.scale(1.5)
|
||||
A_inv, A, eq = lhs.split()
|
||||
identity = Matrix([[1, 0], [0, 1]])
|
||||
identity.set_color_columns(X_COLOR, Y_COLOR)
|
||||
identity.set_column_colors(X_COLOR, Y_COLOR)
|
||||
identity.next_to(eq, RIGHT)
|
||||
VMobject(lhs, identity).center().to_corner(UP+RIGHT)
|
||||
for mob in A, A_inv, eq:
|
||||
|
@ -1051,7 +1051,7 @@ class ThreeDInverseRule(Scene):
|
|||
form = TexMobject("A^{-1} A = ")
|
||||
form.scale(2)
|
||||
matrix = Matrix(np.identity(3, 'int'))
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
matrix.next_to(form, RIGHT)
|
||||
self.add(form)
|
||||
self.play(Write(matrix))
|
||||
|
@ -1280,7 +1280,7 @@ class TowDColumnsDontSpan(LinearTransformationScene):
|
|||
}
|
||||
def construct(self):
|
||||
matrix = Matrix(self.t_matrix.T)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.add_to_back(BackgroundRectangle(matrix))
|
||||
self.add_foreground_mobject(matrix)
|
||||
brace = Brace(matrix)
|
||||
|
@ -1338,7 +1338,7 @@ class ThreeDColumnsDontSpan(Scene):
|
|||
[0, 1, 1],
|
||||
[-1, -2, -1],
|
||||
]).T)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
brace = Brace(matrix)
|
||||
words = brace.get_text(
|
||||
"Columns don't",
|
||||
|
@ -1361,7 +1361,7 @@ class NameColumnSpace(Scene):
|
|||
[0, 1, 1],
|
||||
[-1, -2, -1],
|
||||
]).T)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
matrix.to_corner(UP+LEFT)
|
||||
cols = list(matrix.copy().get_mob_matrix().T)
|
||||
col_arrays = list(map(Matrix, cols))
|
||||
|
@ -1562,7 +1562,7 @@ class RankNumber0(RankNumber):
|
|||
class NameFullRank(Scene):
|
||||
def construct(self):
|
||||
matrix = Matrix([[2, 5, 1], [3, 1, 4], [-4, 0, 0]])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
matrix.to_edge(UP)
|
||||
brace = Brace(matrix)
|
||||
top_words = brace.get_text(
|
||||
|
|
|
@ -1366,10 +1366,10 @@ class SomeKindOfConnection(Scene):
|
|||
v_line.set_stroke(width = 10)
|
||||
|
||||
matrix = Matrix([self.v_coords])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.next_to(number_line, UP, buff = LARGE_BUFF)
|
||||
v_coords = Matrix(self.v_coords)
|
||||
v_coords.set_color_columns(YELLOW)
|
||||
v_coords.set_column_colors(YELLOW)
|
||||
v_coords.scale(0.75)
|
||||
v_coords.next_to(vect.get_end(), RIGHT)
|
||||
for array in matrix, v_coords:
|
||||
|
@ -1604,7 +1604,7 @@ class ProjectSingleVectorOnUHat(ProjectOntoUnitVectorNumberline):
|
|||
class AskAboutProjectionMatrix(Scene):
|
||||
def construct(self):
|
||||
matrix = Matrix([["?", "?"]])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
words = TextMobject("Projection matrix:")
|
||||
VMobject(words, matrix).arrange_submobjects(buff = MED_SMALL_BUFF).shift(UP)
|
||||
basis_words = [
|
||||
|
@ -1912,7 +1912,7 @@ class ScaleUpUHat(ProjectOntoUnitVectorNumberline) :
|
|||
|
||||
def show_matrix(self):
|
||||
matrix = Matrix([list(self.u_hat.coords.get_entries().copy())])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.add_to_back(BackgroundRectangle(matrix))
|
||||
brace = Brace(matrix)
|
||||
words = TextMobject(
|
||||
|
@ -2051,10 +2051,10 @@ class TwoDOneDTransformationSeparateSpace(Scene):
|
|||
v_line.set_stroke(width = 10)
|
||||
|
||||
matrix = Matrix([self.v_coords])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.next_to(number_line, UP, buff = LARGE_BUFF)
|
||||
v_coords = Matrix(self.v_coords)
|
||||
v_coords.set_color_columns(YELLOW)
|
||||
v_coords.set_column_colors(YELLOW)
|
||||
v_coords.scale(0.75)
|
||||
v_coords.next_to(vect.get_end(), RIGHT)
|
||||
for array in matrix, v_coords:
|
||||
|
@ -2159,12 +2159,12 @@ class TranslateToTheWorldOfTransformations(TwoDOneDMatrixMultiplication):
|
|||
Matrix(["x_%d"%n, "y_%d"%n])
|
||||
for n in (1, 2)
|
||||
]
|
||||
v1.set_color_columns(V_COLOR)
|
||||
v2.set_color_columns(W_COLOR)
|
||||
v1.set_column_colors(V_COLOR)
|
||||
v2.set_column_colors(W_COLOR)
|
||||
dot = TexMobject("\\cdot")
|
||||
|
||||
matrix = Matrix([["x_1", "y_1"]])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
|
||||
dot_product = VGroup(v1, dot, v2)
|
||||
dot_product.arrange_submobjects(RIGHT)
|
||||
|
@ -2239,10 +2239,10 @@ class WhatTheVectorWantsToBe(Scene):
|
|||
v_line.set_stroke(width = 10)
|
||||
|
||||
matrix = Matrix([self.v_coords])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.next_to(number_line, UP, buff = LARGE_BUFF)
|
||||
v_coords = Matrix(self.v_coords)
|
||||
v_coords.set_color_columns(YELLOW)
|
||||
v_coords.set_column_colors(YELLOW)
|
||||
v_coords.scale(0.75)
|
||||
v_coords.next_to(vect.get_end(), RIGHT)
|
||||
for array in matrix, v_coords:
|
||||
|
|
|
@ -823,7 +823,7 @@ class Define2dCrossProduct(LinearTransformationScene):
|
|||
FadeIn(self.w.label),
|
||||
FadeIn(self.v.coord_array),
|
||||
FadeIn(self.w.coord_array),
|
||||
matrix.set_color_columns, V_COLOR, W_COLOR
|
||||
matrix.set_column_colors, V_COLOR, W_COLOR
|
||||
)
|
||||
self.wait()
|
||||
self.i_hat, self.j_hat = i_hat, j_hat
|
||||
|
@ -1666,7 +1666,7 @@ class CrossAndDualWords(Scene):
|
|||
["v_1", "v_2", "v_3"],
|
||||
["w_1", "w_2", "w_3"],
|
||||
]).T)
|
||||
matrix.set_color_columns(WHITE, U_COLOR, W_COLOR)
|
||||
matrix.set_column_colors(WHITE, U_COLOR, W_COLOR)
|
||||
det_text = get_det_text(matrix, background_rect = False)
|
||||
det_text.add(matrix)
|
||||
dot_with_cross = TexMobject(
|
||||
|
|
|
@ -195,8 +195,8 @@ class DotProductToTransformSymbol(Scene):
|
|||
|
||||
matrix = Matrix([self.vect_coords])
|
||||
vector = Matrix(self.vect_coords)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
vector.set_color_columns(YELLOW)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
vector.set_column_colors(YELLOW)
|
||||
_input = Matrix(["x", "y"])
|
||||
_input.get_entries().set_color_by_gradient(X_COLOR, Y_COLOR)
|
||||
left_input, right_input = [_input.copy() for x in range(2)]
|
||||
|
@ -352,7 +352,7 @@ class ThreeStepPlan(Scene):
|
|||
["v_%d"%d for d in range(1, 4)],
|
||||
["w_%d"%d for d in range(1, 4)],
|
||||
]).T)
|
||||
matrix.set_color_columns(X_COLOR, V_COLOR, W_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, V_COLOR, W_COLOR)
|
||||
matrix.get_mob_matrix()[1, 0].set_color(Y_COLOR)
|
||||
matrix.get_mob_matrix()[2, 0].set_color(Z_COLOR)
|
||||
VGroup(*matrix.get_mob_matrix()[1, 1:]).shift(0.15*DOWN)
|
||||
|
@ -391,7 +391,7 @@ class DefineDualTransform(Scene):
|
|||
defs_equals = VGroup()
|
||||
definitions = VGroup()
|
||||
for array, tex_mob, color in zip(arrays, tex_mobs, colors):
|
||||
array.set_color_columns(color)
|
||||
array.set_column_colors(color)
|
||||
tex_mob.set_color(color)
|
||||
equals = TexMobject("=")
|
||||
definition = VGroup(tex_mob, equals, array)
|
||||
|
|
|
@ -920,7 +920,7 @@ class TranslateFromJenny(JenniferScene):
|
|||
self.wait()
|
||||
|
||||
matrix = Matrix(np.array([self.b1_coords, self.b2_coords]).T)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
self.jenny.coords.target = self.jenny.coords.copy()
|
||||
self.jenny.coords.target.next_to(equals, LEFT)
|
||||
matrix.set_height(self.jenny.coords.get_height())
|
||||
|
@ -959,7 +959,7 @@ class TalkThroughChangeOfBasisMatrix(JenniferScene):
|
|||
pi.bubble = get_small_bubble(pi)
|
||||
|
||||
matrix = Matrix(np.array([self.b1_coords, self.b2_coords]).T)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.next_to(ORIGIN, RIGHT, buff = MED_SMALL_BUFF).to_edge(UP)
|
||||
|
||||
b1_coords = Matrix(self.b1_coords)
|
||||
|
@ -1124,7 +1124,7 @@ class FeelsBackwards(Scene):
|
|||
JenniferScene.CONFIG["b1_coords"],
|
||||
JenniferScene.CONFIG["b2_coords"],
|
||||
]).T)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.shift(UP)
|
||||
top_arrow = Arrow(matrix.get_left(), matrix.get_right())
|
||||
bottom_arrow = top_arrow.copy().rotate(np.pi)
|
||||
|
@ -1188,7 +1188,7 @@ class RecallInverse(JenniferScene):
|
|||
numerical_t_matrix = np.array([self.b1_coords, self.b2_coords])
|
||||
matrix = Matrix(numerical_t_matrix.T)
|
||||
matrix.add_to_back(BackgroundRectangle(matrix))
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.to_corner(UP+LEFT, buff = MED_LARGE_BUFF)
|
||||
# matrix.shift(MED_SMALL_BUFF*DOWN)
|
||||
inverse_exponent = TexMobject("-1")
|
||||
|
@ -1233,7 +1233,7 @@ class RecallInverse(JenniferScene):
|
|||
self.play(FadeIn(self.jenny))
|
||||
self.play(self.jenny.change_mode, "speaking")
|
||||
#Little hacky now
|
||||
inv_matrix.set_color_columns(X_COLOR)
|
||||
inv_matrix.set_column_colors(X_COLOR)
|
||||
self.play(*[
|
||||
ApplyMethod(
|
||||
mob.scale_in_place, 1.2,
|
||||
|
@ -1242,7 +1242,7 @@ class RecallInverse(JenniferScene):
|
|||
for mob in inv_matrix.get_mob_matrix()[:,0]
|
||||
])
|
||||
self.wait()
|
||||
inv_matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
inv_matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
self.play(*[
|
||||
ApplyMethod(
|
||||
mob.scale_in_place, 1.2,
|
||||
|
@ -1326,7 +1326,7 @@ class SummarizeTranslationProcess(Scene):
|
|||
|
||||
def define_matrix(self):
|
||||
matrix = Matrix([[2, -1], [1, 1]])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
A, equals = list(map(TexMobject, list("A=")))
|
||||
equation = VGroup(A, equals, matrix)
|
||||
equation.arrange_submobjects()
|
||||
|
@ -1447,7 +1447,7 @@ class RotationExample(LinearTransformationScene):
|
|||
words.to_edge(UP)
|
||||
|
||||
matrix = Matrix(self.t_matrix.T)
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.rect = BackgroundRectangle(matrix)
|
||||
matrix.add_to_back(matrix.rect)
|
||||
matrix.next_to(words, DOWN)
|
||||
|
@ -1559,7 +1559,7 @@ class JennyWatchesRotation(JenniferScene):
|
|||
class AksAboutTranslatingColumns(TeacherStudentsScene):
|
||||
def construct(self):
|
||||
matrix = Matrix([[0, -1], [1, 0]])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.scale(0.7)
|
||||
words = TextMobject("Translate columns of")
|
||||
matrix.next_to(words, DOWN)
|
||||
|
@ -1620,10 +1620,10 @@ class HowToTranslateAMatrix(Scene):
|
|||
array.submobjects = submobs
|
||||
her_vector.set_color(MAROON_B)
|
||||
cob_matrix.set_color_by_gradient(BLUE, MAROON_B)
|
||||
transform.set_color_columns(X_COLOR, Y_COLOR)
|
||||
transform.set_column_colors(X_COLOR, Y_COLOR)
|
||||
transform.get_brackets().set_color(BLUE)
|
||||
inv_cob.set_color_by_gradient(MAROON_B, BLUE)
|
||||
result.set_color_columns(X_COLOR, Y_COLOR)
|
||||
result.set_column_colors(X_COLOR, Y_COLOR)
|
||||
result.get_brackets().set_color(MAROON_B)
|
||||
|
||||
final_top_brace = Brace(VGroup(cob_matrix, inv_cob), UP)
|
||||
|
@ -1732,7 +1732,7 @@ class JennyWatchesRotationWithMatrixAndVector(JenniferScene):
|
|||
self.add(self.jenny_plane, self.jenny, self.b1, self.b2)
|
||||
|
||||
matrix = Matrix([["1/3", "-2/3"], ["5/3", "-1/3"]])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
matrix.to_corner(UP+LEFT)
|
||||
|
||||
vector_coords = [1, 2]
|
||||
|
|
|
@ -322,7 +322,7 @@ class ShowMatrixMultiplication(Scene):
|
|||
right = Matrix(np.arange(9).reshape((3, 3)))
|
||||
left = Matrix(np.random.random_integers(-5, 5, (3, 3)))
|
||||
VMobject(left, right).arrange_submobjects(buff = 0.1)
|
||||
right.set_color_columns(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
right.set_column_colors(X_COLOR, Y_COLOR, Z_COLOR)
|
||||
left.set_color(PINK)
|
||||
|
||||
trips = [
|
||||
|
|
|
@ -164,7 +164,7 @@ class DescribeColumnsInSpecificTransformation(Scene):
|
|||
[-1, 1],
|
||||
[-2, 1],
|
||||
])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
mob_matrix = matrix.get_mob_matrix()
|
||||
i_col, j_col = [VMobject(*mob_matrix[:,i]) for i in (0, 1)]
|
||||
for col, char, vect in zip([i_col, j_col], ["i", "j"], [UP, DOWN]):
|
||||
|
@ -195,7 +195,7 @@ class CountRowsAndColumns(Scene):
|
|||
[-1, 1],
|
||||
[-2, 1],
|
||||
])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
rows_brace = Brace(matrix, LEFT)
|
||||
rows_words = rows_brace.get_text("3", "rows")
|
||||
rows_words.set_color(PINK)
|
||||
|
@ -229,7 +229,7 @@ class WriteColumnSpaceDefinition(Scene):
|
|||
[-1, 1],
|
||||
[-2, 1],
|
||||
])
|
||||
matrix.set_color_columns(X_COLOR, Y_COLOR)
|
||||
matrix.set_column_colors(X_COLOR, Y_COLOR)
|
||||
|
||||
brace = Brace(matrix)
|
||||
words = VMobject(
|
||||
|
@ -276,7 +276,7 @@ class MatrixInTheWild(Scene):
|
|||
ShowCreation(bubble),
|
||||
randy.change_mode, "pondering"
|
||||
)
|
||||
# self.play(matrix.set_color_columns, X_COLOR, Y_COLOR)
|
||||
# self.play(matrix.set_column_colors, X_COLOR, Y_COLOR)
|
||||
self.wait()
|
||||
for x in range(3):
|
||||
self.play(Blink(randy))
|
||||
|
@ -309,7 +309,7 @@ class MatrixInTheWild(Scene):
|
|||
self.play(
|
||||
GrowFromCenter(top_brace),
|
||||
Write(top_words),
|
||||
matrix.set_color_columns, X_COLOR, Y_COLOR, Z_COLOR
|
||||
matrix.set_column_colors, X_COLOR, Y_COLOR, Z_COLOR
|
||||
)
|
||||
self.play(randy.change_mode, "happy")
|
||||
self.play(
|
||||
|
|
Loading…
Add table
Reference in a new issue