From 1697d2286a00b1bfdac00320a60c968ac5a45eaf Mon Sep 17 00:00:00 2001 From: Archit Sangal Date: Sun, 5 Jul 2020 18:19:17 +0530 Subject: Video 3: For Algo of GSOP added --- .../file2_orthonormal.py | 207 ++++++++++++++++++--- 1 file changed, 183 insertions(+), 24 deletions(-) diff --git a/FSF-2020/linear-algebra/linear-transformations/Gram Schmidt Orthonormalization Process/file2_orthonormal.py b/FSF-2020/linear-algebra/linear-transformations/Gram Schmidt Orthonormalization Process/file2_orthonormal.py index 640b8be..af51fc6 100644 --- a/FSF-2020/linear-algebra/linear-transformations/Gram Schmidt Orthonormalization Process/file2_orthonormal.py +++ b/FSF-2020/linear-algebra/linear-transformations/Gram Schmidt Orthonormalization Process/file2_orthonormal.py @@ -1,18 +1,153 @@ from manimlib.imports import * -from manimlib.imports import * - -class Orthogonal(ThreeDScene): +class Algo(ThreeDScene): def construct(self): - text = TextMobject(r"These are two Orthogonal Basis $\alpha_{1}$ and $\alpha_{2}$") + axes = ThreeDAxes(x_min = -5,x_max=5,y_min=-3,y_max=3,z_min=-4,z_max=4) + self.play(ShowCreation(axes)) + + text = TextMobject(r"This is the vector $\beta_1(=\left[\begin{array}{c} 4\\0\\0 \end{array}\right])$") + text.set_color(GREEN) + text.scale(0.6) + text.move_to(3*UP+5*LEFT) + self.play(Write(text)) + + arrow_a = Arrow(start = ORIGIN, end = 4*RIGHT) + arrow_a.set_color(GREEN) + arrow_a.scale(1.15) + self.play(ShowCreation(arrow_a)) + + text_a = TextMobject(r"$\beta_1$") + text_a.move_to(0.4*DOWN+3*RIGHT) + text_a.set_color(GREEN) + text_a.scale(0.75) + self.play(Write(text_a)) + self.wait() + self.play(FadeOut(text)) + + text = TextMobject(r"Normalize $\beta_1$ to get $\alpha_1$") + text.set_color(DARK_BLUE) text.scale(0.75) + text.move_to(3*UP+5*LEFT) + self.play(Write(text)) + + alpha_1 = Arrow(start = ORIGIN,end = RIGHT) + alpha_1.scale(1.9) + alpha_1.set_color(DARK_BLUE) + text_alpha_1 = TextMobject(r"$\alpha_1$") + text_alpha_1.move_to(0.4*DOWN+RIGHT) + text_alpha_1.set_color(DARK_BLUE) + text_alpha_1.scale(0.75) + self.play(Transform(text_a,text_alpha_1), Transform(arrow_a,alpha_1)) + self.wait() + self.play(FadeOut(text)) + + text = TextMobject(r"Consider another vector $\beta_2(=\left[\begin{array}{c} 2\\2\\0 \end{array}\right])$") + text1 = TextMobject(r"which is linearly independent to $\beta_1$") + text.set_color(GREEN) + text1.set_color(GREEN) + text.scale(0.6) + text1.scale(0.6) + text.move_to(3*UP+4*LEFT) + text1.move_to(2*UP+4*LEFT) + self.play(Write(text)) + self.play(Write(text1)) + + arrow_b = Arrow(start = ORIGIN, end = 2*UP+2*RIGHT) + arrow_b.scale(1.2) + arrow_b.set_color(GREEN) + text_b = TextMobject(r"$\beta_2$") + text_b.move_to(1.5*UP+RIGHT) + text_b.set_color(GREEN) + text_b.scale(0.75) + + self.play(ShowCreation(arrow_b), Write(text_b)) + self.wait() + + arrow_b_copy = Arrow(start = ORIGIN, end = 2*UP+2*RIGHT) + arrow_b_copy.scale(1.2) + + arrow_p = Arrow(start = ORIGIN, end = 2*RIGHT) + arrow_p.scale(1.35) + arrow_p.set_color(GOLD_E) + + text_p = TextMobject("p") + text_p.move_to(0.25*DOWN+RIGHT) + text_p.set_color(GOLD_E) + + self.play(FadeOut(text), FadeOut(text1), Transform(arrow_b_copy,arrow_p), FadeOut(text_a), FadeOut(text_b)) + text = TextMobject(r"$p$ is the projection of $\beta_2$ on $\alpha_1$") + text.set_color(GOLD_E) + text.move_to(3*UP+4*LEFT) + text.scale(0.8) + self.play(Write(text),Write(text_p)) + self.wait() + + self.play(FadeIn(text_b)) + + arrow_o = Arrow(start = 2*RIGHT, end = 2*UP+2*RIGHT) + arrow_o.scale(1.35) + arrow_o.set_color(PURPLE_E) + + text_o = TextMobject(r"$\beta_2-p$") + text_o.move_to(UP+2.7*RIGHT) + text_o.scale(0.75) + text_o.set_color(PURPLE_E) + + self.play(ShowCreation(arrow_o)) + self.play(FadeOut(text),Write(text_o)) + + text = TextMobject(r"$\beta_2-p$ is orthogonal to p") + text1 = TextMobject(r"(and hence orthogonal to $\alpha_1$ also)") + text.set_color(PURPLE_E) + text1.set_color(PURPLE_E) + text.scale(0.7) + text1.scale(0.7) + text.move_to(3*UP+4*LEFT) + text1.move_to(2.5*UP+4*LEFT) + self.play(Write(text)) + self.play(Write(text1)) + self.wait(2) + + self.play(FadeOut(text_p), FadeIn(arrow_a), FadeOut(text), FadeOut(text1), FadeOut(arrow_b_copy), FadeOut(arrow_p), FadeOut(text_b), FadeOut(arrow_b)) + self.play(ApplyMethod(arrow_o.move_to,UP), ApplyMethod(text_o.move_to,RIGHT+UP)) + + text = TextMobject(r"Now, Normalize $\beta_2-p$") + text.set_color(DARK_BLUE) + text.scale(0.6) + text.move_to(3*UP+4*LEFT) + self.play(Write(text)) + + alpha_2 = Arrow(start = ORIGIN,end = UP) + alpha_2.scale(1.9) + alpha_2.set_color(DARK_BLUE) + text_alpha_2 = TextMobject(r"$\alpha_2$") + text_alpha_2.move_to(0.4*LEFT+UP) + text_alpha_2.set_color(DARK_BLUE) + text_alpha_2.scale(0.75) + self.play(Transform(text_o,text_alpha_2), Transform(arrow_o,alpha_2), FadeIn(text_a)) + self.wait() + self.play(FadeOut(text),FadeOut(text_a),FadeOut(text_o)) + + self.add(axes) + ############################################################################# + axis = TextMobject(r"$\alpha_1$",r"$\alpha_2$",r"$\alpha_3$",r"$\beta_3$",r"$\alpha_3$",r"$\alpha_3$",r"$\alpha_3$",r"$\alpha_3$") + axis.scale(0.5) + axis[0].move_to(0.5*RIGHT+[0,0,-0.5]) + axis[1].move_to(0.5*UP+[0,0,-0.5]) + axis[2].move_to(np.array([0,0,0.5])) + axis[3].move_to(np.array([1,1,1.5])) + self.add_fixed_orientation_mobjects(axis[0]) + self.add_fixed_orientation_mobjects(axis[1]) + ############################################################################# + + text = TextMobject(r"These are the same two orthonormal vectors $\alpha_{1}$ and $\alpha_{2}$") + text.scale(0.6) + text.set_color(DARK_BLUE) self.add_fixed_in_frame_mobjects(text) text.move_to(3*(DOWN+RIGHT)) self.play(Write(text)) - axes = ThreeDAxes() - self.play(ShowCreation(axes)) self.move_camera(phi=60*DEGREES,theta=45*DEGREES,run_time=3) self.begin_ambient_camera_rotation(rate=0.3) @@ -31,7 +166,7 @@ class Orthogonal(ThreeDScene): tip2.set_color(DARK_BLUE) arrow2.set_color(DARK_BLUE) - self.play(ShowCreation(line1), ShowCreation(tip1), ShowCreation(arrow2), ShowCreation(tip2)) + self.play(ShowCreation(line1), ShowCreation(tip1), ShowCreation(arrow2), ShowCreation(tip2), FadeOut(arrow_a), FadeOut(arrow_o)) self.wait() a_line = Line(start = ORIGIN,end = 2*UP+2*RIGHT+[0,0,2]) @@ -50,9 +185,11 @@ class Orthogonal(ThreeDScene): self.play(FadeOut(text), ShowCreation(a_line), ShowCreation(a_tip), ShowCreation(a_line_c1), ShowCreation(a_tip_c1)) - text = TextMobject(r"There is a vector $\beta_3$") - text.scale(0.75) + text = TextMobject(r"Now, we have a vector $\beta_3(=\left[\begin{array}{c} 2\\2\\2 \end{array}\right])$") + text.set_color(GOLD_E) + text.scale(0.7) self.add_fixed_in_frame_mobjects(text) + self.add_fixed_orientation_mobjects(axis[3]) text.move_to(3*(DOWN+RIGHT)) self.play(Write(text)) self.wait() @@ -69,7 +206,8 @@ class Orthogonal(ThreeDScene): self.play(Transform(a_line_c1,p_line1),Transform(a_tip_c1,p_tip1)) text = TextMobject(r"Take projection of $\beta_3$ on $\alpha_1$") - text.scale(0.75) + text.scale(0.6) + text.set_color(GOLD_E) self.add_fixed_in_frame_mobjects(text) text.move_to(3*(DOWN+RIGHT)) self.play(Write(text)) @@ -98,14 +236,15 @@ class Orthogonal(ThreeDScene): a_tip1_c1.set_color(GREEN_E) text = TextMobject(r"$\beta_3$-(projection of $\beta_3$ on $\alpha_1$)") - text.scale(0.75) + text.set_color(GREEN_E) + text.scale(0.6) self.add_fixed_in_frame_mobjects(text) text.move_to(3*(DOWN+RIGHT)) self.play(Write(text)) self.play(ShowCreation(o_line1), ShowCreation(o_tip1)) self.wait(2) self.play(FadeOut(a_line_c1), FadeOut(a_tip_c1), - FadeOut(a_line), FadeOut(a_tip), + FadeOut(a_line), FadeOut(a_tip), FadeOut(axis[3]), Transform(o_line1,a_line1), Transform(o_tip1,a_tip1)) self.wait() @@ -120,16 +259,17 @@ class Orthogonal(ThreeDScene): p_arrow2.set_color(GOLD_E) last_a = Line(start = 2*UP,end = [0,2,2]) - last_a.set_color(GOLD_E) + last_a.set_color(PURPLE_E) last_a_tip = Polygon([0,0,2],[0,0,1.8]+0.2*RIGHT,[0,0,1.8]+0.2*LEFT) last_a_tip.move_to([0,2,2]) last_a_tip.set_opacity(1) - last_a_tip.set_fill(GOLD_E) - last_a_tip.set_color(GOLD_E) + last_a_tip.set_fill(PURPLE_E) + last_a_tip.set_color(PURPLE_E) self.wait() text = TextMobject(r"Take projection on $\alpha_2$") - text.scale(0.75) + text.scale(0.6) + text.set_color(GOLD_E) self.add_fixed_in_frame_mobjects(text) text.move_to(3*(DOWN+RIGHT)) self.play(Write(text)) @@ -138,9 +278,10 @@ class Orthogonal(ThreeDScene): self.play(FadeOut(text)) text = TextMobject(r"$\beta_3$-(projection of $\beta_3$ on $\alpha_1$ + projection of $\beta_3$ on $\alpha_2$)") - text.scale(0.75) + text.set_color(PURPLE_E) + text.scale(0.6) self.add_fixed_in_frame_mobjects(text) - text.move_to(3*DOWN+2*RIGHT) + text.move_to(3*DOWN+3.5*RIGHT) self.play(Write(text)) self.play(ShowCreation(o_line1), ShowCreation(o_tip1)) self.wait(2) @@ -149,19 +290,26 @@ class Orthogonal(ThreeDScene): self.play(FadeOut(text)) larrow3 = Line(start = ORIGIN,end = [0,0,2]) - larrow3.set_color(GOLD_E) + larrow3.set_color(PURPLE_E) ltip3 = Polygon([0,0,2],[0,0,1.8]+0.2*RIGHT,[0,0,1.8]+0.2*LEFT) ltip3.set_opacity(1) - ltip3.set_fill(GOLD_E) - ltip3.set_color(GOLD_E) + ltip3.set_fill(PURPLE_E) + ltip3.set_color(PURPLE_E) self.wait() self.play(FadeOut(o_line1), FadeOut(o_tip1), FadeOut(a_line1_c1), FadeOut(a_tip1_c1), Transform(last_a,larrow3), Transform(last_a_tip,ltip3)) - text = TextMobject(r"Normalisation of the orthogonal vector") - text.scale(0.75) + text = TextMobject(r"Normalize, the vector") + text1 = TextMobject(r"$\beta_3$-(projection of $\beta_3$ on $\alpha_1$ + projection of $\beta_3$ on $\alpha_2$") + text.set_color(PURPLE_E) + text1.set_color(PURPLE_E) + text.scale(0.6) + text1.scale(0.6) self.add_fixed_in_frame_mobjects(text) - text.move_to(3*DOWN+2*RIGHT) + self.add_fixed_in_frame_mobjects(text1) + text.move_to(3*DOWN+3*RIGHT) + text1.move_to(3.5*DOWN+3*RIGHT) self.play(Write(text)) + self.play(Write(text1)) arrow3 = Line(start = ORIGIN,end = [0,0,1]) arrow3.set_color(DARK_BLUE) @@ -170,5 +318,16 @@ class Orthogonal(ThreeDScene): tip3.set_fill(DARK_BLUE) tip3.set_color(DARK_BLUE) self.play(Transform(last_a,arrow3), Transform(last_a_tip,tip3)) + self.add_fixed_orientation_mobjects(axis[2]) + + self.wait() + self.play(FadeOut(text),FadeOut(text1)) + + text = TextMobject(r"These are the three orthonormal vectors $\alpha_1, \alpha_2, \alpha_3$") + text.set_color(DARK_BLUE) + self.add_fixed_in_frame_mobjects(text) + text.scale(0.6) + text.move_to(3*DOWN+3.5*RIGHT) + self.play(Write(text)) self.wait(3) \ No newline at end of file -- cgit From 7b7ae0deb322b097c5e5940f6b9789a641af205a Mon Sep 17 00:00:00 2001 From: Archit Sangal Date: Sun, 5 Jul 2020 19:36:24 +0530 Subject: code for last video of GSOP added --- .../file3_Non_Standard_Basis.py | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 FSF-2020/linear-algebra/linear-transformations/Gram Schmidt Orthonormalization Process/file3_Non_Standard_Basis.py diff --git a/FSF-2020/linear-algebra/linear-transformations/Gram Schmidt Orthonormalization Process/file3_Non_Standard_Basis.py b/FSF-2020/linear-algebra/linear-transformations/Gram Schmidt Orthonormalization Process/file3_Non_Standard_Basis.py new file mode 100644 index 0000000..6410a2c --- /dev/null +++ b/FSF-2020/linear-algebra/linear-transformations/Gram Schmidt Orthonormalization Process/file3_Non_Standard_Basis.py @@ -0,0 +1,51 @@ +from manimlib.imports import * + +class NSB(ThreeDScene): + def construct(self): + + axes = ThreeDAxes(x_min = -4,x_max=4,y_min=-4,y_max=4,z_min=-4,z_max=4) + self.play(ShowCreation(axes)) + self.move_camera(phi=60*DEGREES,theta=45*DEGREES,run_time=3) + self.begin_ambient_camera_rotation(rate=0.5) + + matrix = [[0.577,0.577,0.577],[-0.577,0.577,0.577],[0.577,-0.577,0.577]] + + line1 = Line(start = ORIGIN,end = 1*RIGHT) + line1.set_color(DARK_BLUE) + tip1 = Polygon(RIGHT,0.9*RIGHT-0.1*DOWN,0.9*RIGHT-0.1*UP) + tip1.set_opacity(1) + tip1.set_fill(DARK_BLUE) + tip1.set_color(DARK_BLUE) + + arrow2 = Line(start = ORIGIN,end = 1*UP) + arrow2.set_color(DARK_BLUE) + tip2 = Polygon(UP,0.9*UP-0.1*RIGHT,0.9*UP-0.1*LEFT) + tip2.set_opacity(1) + tip2.set_fill(DARK_BLUE) + tip2.set_color(DARK_BLUE) + arrow2.set_color(DARK_BLUE) + + arrow3 = Line(start = ORIGIN,end = [0,0,1]) + arrow3.set_color(DARK_BLUE) + tip3 = Polygon([0,0,1],[0,0,0.9]-0.1*RIGHT,[0,0,0.9]-0.1*LEFT) + tip3.set_opacity(1) + tip3.set_fill(DARK_BLUE) + tip3.set_color(DARK_BLUE) + + line1.apply_matrix(matrix) + tip1.apply_matrix(matrix) + arrow2.apply_matrix(matrix) + tip2.apply_matrix(matrix) + arrow3.apply_matrix(matrix) + tip3.apply_matrix(matrix) + + self.play(ShowCreation(line1), ShowCreation(tip1), ShowCreation(arrow2), ShowCreation(tip2), ShowCreation(arrow3), ShowCreation(tip3)) + + text = TextMobject(r"This is also a set of Orthonormal Vectors") + text.set_color(DARK_BLUE) + self.add_fixed_in_frame_mobjects(text) + text.scale(0.6) + text.move_to(3*DOWN+3.5*RIGHT) + self.play(Write(text)) + + self.wait(7) \ No newline at end of file -- cgit From f818aa6face482b21a46b2da9a32b27c212f5d4c Mon Sep 17 00:00:00 2001 From: Archit Sangal Date: Sun, 5 Jul 2020 21:21:57 +0530 Subject: modification to an animation --- .../file_before_matrix.py | 85 +++++++++++++++------- 1 file changed, 60 insertions(+), 25 deletions(-) mode change 100644 => 100755 FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file_before_matrix.py diff --git a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file_before_matrix.py b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file_before_matrix.py old mode 100644 new mode 100755 index 85a2983..e0476a3 --- a/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file_before_matrix.py +++ b/FSF-2020/linear-algebra/linear-transformations/Linear-Transformations-(Linear-Maps)/file_before_matrix.py @@ -1,13 +1,13 @@ from manimlib.imports import * -class linear(GraphScene): +class Linear(GraphScene): CONFIG = { "x_min": -5, "x_max": 5, "y_min": -5, "y_max": 5, - "graph_origin": ORIGIN+RIGHT, + "graph_origin": ORIGIN, "x_labeled_nums": list(range(-5, 6)), "y_labeled_nums": list(range(-5, 6)), "x_axis_width": 7, @@ -22,6 +22,7 @@ class linear(GraphScene): self.setup_axes(animate = True) heading = TextMobject(r"$T(x,y) = T(x+2y,x-y)$") heading.move_to(UP*3+LEFT*4) + heading.scale(0.7) self.play(Write(heading)) self.wait() @@ -34,44 +35,42 @@ class linear(GraphScene): dot1.set_color(DARK_BLUE) dot2.set_color(DARK_BLUE) p1 = TextMobject(r"$P_1$") + p1.scale(0.75) p1.set_color(DARK_BLUE) - p1.move_to(self.graph_origin+1*XTD*RIGHT+2*YTD*UP) + p1.move_to(self.graph_origin+1*XTD*RIGHT+1.5*YTD*UP) p2 = TextMobject(r"$P_2$") p2.set_color(DARK_BLUE) - p2.move_to(self.graph_origin+2*XTD*RIGHT+2*YTD*UP) + p2.scale(0.75) + p2.move_to(self.graph_origin+2*XTD*RIGHT+1.5*YTD*UP) after = TextMobject("After applying Linear Transformation") after.set_color(RED) after.move_to(3*UP+4.5*RIGHT) - after.scale(0.75) + after.scale(0.5) dot3 = Dot().shift(self.graph_origin+3*XTD*RIGHT+0*YTD*UP) dot4 = Dot().shift(self.graph_origin+4*XTD*RIGHT+1*YTD*UP) dot3.set_color(RED) dot4.set_color(RED) - p3 = TextMobject(r"$P_3$") + p3 = TextMobject(r"$T(P_1)$") + p3.scale(0.7) p3.set_color(RED) p3.move_to(self.graph_origin+3*XTD*RIGHT-1.1*YTD*UP) - p4 = TextMobject(r"$P_4$") + p4 = TextMobject(r"$T(P_2)$") + p4.scale(0.7) p4.set_color(RED) - p4.move_to(self.graph_origin+4*XTD*RIGHT+2*YTD*UP) - - tp1 = TextMobject(r"$T(P_1) = P_3$") - tp1.set_color(RED) - tp1.move_to(DOWN+4*LEFT) - tp2 = TextMobject(r"$T(P_2) = P_4$") - tp2.set_color(RED) - tp2.move_to(2*DOWN+4*LEFT) + p4.move_to(self.graph_origin+4*XTD*RIGHT+1.5*YTD*UP) self.play(Write(before), ShowCreation(dot1), ShowCreation(dot2),Write(p1), Write(p2)) self.wait(3) - self.play(Transform(before,after), Transform(dot1,dot3), Transform(dot2,dot4), Transform(p2,p4), Transform(p1,p3), Write(tp1), Write(tp2)) + self.play(Transform(before,after), Transform(dot1,dot3), Transform(dot2,dot4), Transform(p2,p4), Transform(p1,p3)) self.wait(3) class withgrid(LinearTransformationScene): def construct(self): - heading = TextMobject(r"$T(x,y) = (x+2y,x-y)$") + heading = TextMobject(r"Now, Imagine this happening for all the vectors") + heading.scale(0.5) heading.move_to(UP*2.5+LEFT*4) self.play(Write(heading)) self.wait() @@ -93,9 +92,11 @@ class withgrid(LinearTransformationScene): self.add_transformable_mobject(dot2_c) p1 = TextMobject(r"$P_1$") + p1.scale(0.75) p1.set_color(DARK_BLUE) p1.move_to(1*RIGHT+1.5*UP) p2 = TextMobject(r"$P_2$") + p2.scale(0.75) p2.set_color(DARK_BLUE) p2.move_to(2*RIGHT+1.5*UP) @@ -107,10 +108,12 @@ class withgrid(LinearTransformationScene): dot4 = Dot().shift(4*RIGHT+1*UP) dot3.set_color(RED) dot4.set_color(RED) - p3 = TextMobject(r"$P_3$") + p3 = TextMobject(r"$T(P_1)$") + p3.scale(0.75) p3.set_color(RED) p3.move_to(3*RIGHT-0.6*UP) - p4 = TextMobject(r"$P_4$") + p4 = TextMobject(r"$T(P_2)$") + p4.scale(0.75) p4.set_color(RED) p4.move_to(4*RIGHT+1.5*UP) @@ -118,6 +121,7 @@ class withgrid(LinearTransformationScene): self.wait(3) matrix = [[1,2],[1,-1]] self.apply_matrix(matrix) + self.play(FadeOut(dot1),FadeOut(dot2)) self.play(Transform(before,after), Transform(p2,p4), Transform(p1,p3)) self.play(Transform(before,after)) self.wait(3) @@ -141,17 +145,28 @@ class ThreeDExplanation(ThreeDScene): before = TextMobject("Before Linear Transformation") self.add_fixed_in_frame_mobjects(before) - before.set_color(GREEN_E) + before.set_color(YELLOW) before.move_to(3.5*UP+4*RIGHT) before.scale(0.75) + + p1 = TextMobject(r"$P_1$") + p2 = TextMobject(r"$P_2$") + p3 = TextMobject(r"$P_3$") + p1.scale(0.75) + p2.scale(0.75) + p3.scale(0.75) dot1 = Dot().shift(1*RIGHT+1*UP) dot2 = Dot().shift(2*RIGHT+1*UP) - dot3 = Dot().shift(1*RIGHT+1*UP) - dot1.set_color(GREEN_E) - dot2.set_color(GREEN_E) - dot3.set_color(GREEN_E) + dot3 = Dot().shift(1*RIGHT+1*DOWN) + dot1.set_color(YELLOW) + dot2.set_color(YELLOW) + dot3.set_color(YELLOW) self.play(ShowCreation(before)) - + + p1.move_to(1*RIGHT+1*UP+[0,0,0.5]) + p2.move_to(2*RIGHT+1*UP+[0,0,0.5]) + p3.move_to(1*RIGHT-1*UP+[0,0,0.5]) + dot1_c = Dot(radius = 0.05).shift(1*RIGHT+1*UP) dot2_c = Dot(radius = 0.05).shift(0*RIGHT+2*UP) dot3_c = Dot(radius = 0.05).shift(1*RIGHT-1*UP) @@ -168,6 +183,9 @@ class ThreeDExplanation(ThreeDScene): self.stop_ambient_camera_rotation() plane = NumberPlane() + self.add_fixed_orientation_mobjects(p1) + self.add_fixed_orientation_mobjects(p2) + self.add_fixed_orientation_mobjects(p3) self.play(ShowCreation(dot1),ShowCreation(dot3),ShowCreation(dot2),ShowCreation(plane)) self.play(FadeOut(before)) @@ -177,8 +195,23 @@ class ThreeDExplanation(ThreeDScene): after.move_to(3.5*UP+3.5*RIGHT) after.scale(0.75) + self.play(FadeOut(p1),FadeOut(p2),FadeOut(p3)) matrix = [[1,1],[1,-1],[2,1]] self.play(FadeOut(dot1),FadeOut(dot2),FadeOut(dot3),ApplyMethod(plane.apply_matrix,matrix),ApplyMethod(dot1_c.apply_matrix,matrix),ApplyMethod(dot3_c.apply_matrix,matrix),ApplyMethod(dot2_c.apply_matrix,matrix)) + + p4 = TextMobject(r"$T(P_1)$") + p5 = TextMobject(r"$T(P_2)$") + p6 = TextMobject(r"$T(P_3)$") + p4.scale(0.75) + p5.scale(0.75) + p6.scale(0.75) + p4.move_to(2*RIGHT+0*UP+[0,0,3.5]) + p5.move_to(2*RIGHT-2*UP+[0,0,2.5]) + p6.move_to(0*RIGHT+2*UP+[0,0,1.5]) + self.add_fixed_orientation_mobjects(p5) + self.add_fixed_orientation_mobjects(p4) + self.add_fixed_orientation_mobjects(p6) + self.begin_ambient_camera_rotation(rate=0.3) self.wait(3) self.stop_ambient_camera_rotation() @@ -188,4 +221,6 @@ class ThreeDExplanation(ThreeDScene): ending.move_to(-UP*2+LEFT*4) self.play(Transform(text,ending)) self.add_fixed_in_frame_mobjects(ending) + + self.play(FadeOut(plane)) self.wait(9) -- cgit