summaryrefslogtreecommitdiff
path: root/FSF-2020/calculus-of-several-variables/geometry-of-planes-and-curves/equations-of-planes-and-lines/file2_point_normal_form_plane.py
blob: 122a9ffe4f29b27981a71afd9f85c5fecb8ed66e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from manimlib.imports import *

class pointnormal(ThreeDScene):
    def construct(self):
        axes = ThreeDAxes()

        self.set_camera_orientation(phi = 75*DEGREES, theta=45*DEGREES)
        normal = Arrow((0,-0.15,-0.25), (-3,0,3), color = YELLOW)
        plane1 = Polygon(np.array([1,0,2]),np.array([-1,2.5,1]),np.array([-3,2,1]),np.array([-1,-1,2]), color = GREEN_E, fill_color = WHITE, fill_opacity=0.5)
        plane2 = Polygon(np.array([1,0,2]),np.array([-1,2.5,1]),np.array([-3,2,1]),np.array([-1,-1,2]), color = BLUE, fill_color = WHITE, fill_opacity=0.3)
        normalLabel = TextMobject(r'$\overrightarrow{n}$').shift((2,2.5,0))
        pointLabel = TextMobject(r'$P$').shift((2,1.2,0))
        xlabel = TextMobject(r'$x$').shift(4.5*LEFT + 1.7*DOWN)
        ylabel = TextMobject(r'$y$').shift(4.5*RIGHT + 1.8*DOWN)
        zlabel = TextMobject(r'$z$').shift(3.3*UP+0.5*RIGHT)

        normaltext = TextMobject(r'Consider an arbitrary \\ normal vector $\overrightarrow{n}$').scale(0.6).shift(2*UP + 2.5*LEFT)
        planetext = TextMobject(r'A single vector is normal \\ to infinitely many planes.').scale(0.6).shift(2*UP + 2.5*LEFT)
        pointtext = TextMobject(r'Given a fixed point $P$, \\ a plane is obtained as:').scale(0.6).shift(2*UP + 2.5*LEFT)

        point = Dot(color = RED).shift((1.6,1.3,0))
        self.play(FadeIn(axes))
        self.add_fixed_in_frame_mobjects(xlabel, ylabel, zlabel)
        self.wait(1)
        self.play(FadeIn(normal))
        self.add_fixed_in_frame_mobjects(normalLabel, normaltext)
        self.play(FadeIn(normaltext))
        self.wait(2)
        self.add_fixed_in_frame_mobjects(planetext)
        self.play(ReplacementTransform(normaltext, planetext), run_time=0.01)
        self.play(MoveAlongPath(plane1, normal), run_time = 6)
        self.add_fixed_in_frame_mobjects(pointtext)
        self.play(ReplacementTransform(planetext, pointtext))
        self.add_fixed_in_frame_mobjects(point, pointLabel)
        self.wait(1)
        self.play(Transform(plane1, plane2))
        self.wait(2)
        self.play(FadeOut(axes), FadeOut(plane2), FadeOut(plane1), FadeOut(point), FadeOut(pointLabel), FadeOut(normal), FadeOut(normalLabel), FadeOut(planetext), FadeOut(pointtext), FadeOut(normaltext), FadeOut(VGroup(*[xlabel, ylabel, zlabel])))
        self.wait(1)