from manim import *
from manim_physics import *
from manim.typing import Point3D
from manim.utils.rate_functions import sqrt
import numpy as np


class mov1(ThreeDScene):
    def construct(self):

        self.camera.background_color = WHITE

        ax = ThreeDAxes(
            x_range=[-0.3, 10.3, 1],
            y_range=[-0.3, 10.3, 1],
            z_range=[-0.3, 10.3, 1],
            x_length=7.5,
            y_length=7.5,
            axis_config={
                "color": BLACK,
            },
        )

        self.set_camera_orientation(
            phi=55 * DEGREES, theta=-45 * DEGREES, gamma=-7 * DEGREES, zoom=0.5
        )

        axes_lables = ax.get_axis_labels().set_color(BLACK)

        graph = ax.plot_parametric_curve(
            lambda u: (u, u, u**2), t_range=(0, 3, 0.01), color=RED
        )

        point = Dot3D(point=ax.c2p(2, 2, 4), color=BLUE, radius=0.3)

        self.add(ax, axes_lables, graph, point)


class mov2(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        graph = FunctionGraph(
            lambda t: sqrt(t), x_range=[0, 10, 0.01], color=RED
        ).move_to([-0.5, 0, 0])

        point = Dot(point=[0, 0.8, 0], color=BLUE, radius=0.08)

        vvec = Arrow([-0.2, 0.7, 0], [1, 1, 0], color=GREEN)

        self.add(graph, point, vvec)


class mov3(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = (
            Polygram(
                [
                    [1, 1, 0],
                    [-1, 1.5, 0],
                    [-2, 2, 0],
                    [-3, 1, 0],
                    [-1, 0, 0],
                    [0, -1, 0],
                ],
            )
            .set_color(BLACK)
            .round_corners(radius=0.73)
        )

        dota = Dot(ORIGIN, color=RED, radius=0.08)
        dotb = Dot([-2, 1, 0], color=BLUE, radius=0.08)

        vl = Line([2, -1, 0], [-4, 2, 0], color=GREEN)

        va = Arrow(ORIGIN, [1, 1, 0], color=PINK)
        vb = Arrow([-2, 1, 0], [-2.7, -2, 0], color=PINK)
        vap = Arrow([-0.2, 0.1, 0], [0.7, -0.35, 0], color=PURPLE)
        vbp = Arrow([-2.2, 1.1, 0], [-1.2, 0.6, 0], color=PURPLE)

        ta = MathTex(r"A", color=BLACK).move_to([-2, 1.5, 0])
        tb = MathTex(r"B", color=BLACK).move_to([0, 0.5, 0])
        tva = MathTex(r"\vec{v}_A", color=BLACK).move_to([1, 1.5, 0])
        tvb = MathTex(r"\vec{v}_B", color=BLACK).move_to([-2.7, -2.5, 0])
        tvap = MathTex(r"\vec{v}_A '", color=BLACK).move_to([0.7, 0.15, 0])
        tvbp = MathTex(r"\vec{v}_B '", color=BLACK).move_to([-1.2, 1.1, 0])

        self.add(body, dota, dotb, vl, va, vb, vap, vbp, ta, tb, tva, tvb, tvap, tvbp)


class mov4(ThreeDScene):
    def construct(self):

        self.camera.background_color = WHITE

        ax = ThreeDAxes(
            x_range=[-0.3, 10.3, 1],
            y_range=[-0.3, 10.3, 1],
            z_range=[-0.3, 10.3, 1],
            x_length=7.5,
            y_length=7.5,
            axis_config={
                "color": BLACK,
            },
        )

        self.set_camera_orientation(
            phi=50 * DEGREES, theta=5 * DEGREES, gamma=0 * DEGREES, zoom=0.5
        )

        axes_lables = ax.get_axis_labels().set_color(BLACK)

        body = Sphere([0, 0, 2], radius=1, color=BLUE)

        vvec1 = Arrow3D([0, 1, 3], [0, 2, 3], color=RED)
        vvec2 = Arrow3D([0, 1, 2], [0, 2, 2], color=RED)
        vvec3 = Arrow3D([0, 1, 1], [0, 2, 1], color=RED)

        self.add(ax, axes_lables, body, vvec1, vvec2, vvec3)


class mov5(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = (
            Polygram(
                [
                    [2, 1, 0],
                    [0, 1.5, 0],
                    [-1, 2, 0],
                    [-2, 1, 0],
                    [0, 0, 0],
                    [1, -1, 0],
                ],
            )
            .set_color(BLACK)
            .round_corners(radius=0.73)
        )

        dota = Dot(ORIGIN, color=RED, radius=0.08)
        dotb = Dot([-1, 1, 0], color=BLUE, radius=0.08)
        dotc = Dot([1, 0.5, 0], color=GREEN, radius=0.08)

        va = Arrow(ORIGIN, [1, 1, 0], color=PINK)
        vb = Arrow([-1, 1, 0], [0, 2, 0], color=PINK)
        vc = Arrow([1, 0.5, 0], [2, 1.5, 0], color=PINK)

        ta = MathTex(r"A", color=BLACK).move_to([0, 0.5, 0])
        tb = MathTex(r"B", color=BLACK).move_to([-1, 1.5, 0])
        tc = MathTex(r"C", color=BLACK).move_to([1, 1, 0])
        tva = MathTex(r"\vec{v}_A", color=BLACK).move_to([1, 1.5, 0])
        tvb = MathTex(r"\vec{v}_B", color=BLACK).move_to([0, 2.5, 0])
        tvc = MathTex(r"\vec{v}_C", color=BLACK).move_to([2, 2, 0])

        self.add(body, dota, dotb, dotc, va, vb, vc, ta, tb, tc, tva, tvb, tvc)


class mov6(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = (
            Polygram(
                [
                    [2, 1, 0],
                    [0, 1.5, 0],
                    [-1, 2, 0],
                    [-2, 1, 0],
                    [0, 0, 0],
                    [1, -1, 0],
                ],
            )
            .set_color(BLACK)
            .round_corners(radius=0.73)
        )

        vvec1 = CurvedArrow([1.5, 1.5, 0], [0.5, 2.5, 0], color=PINK)
        vvec2 = CurvedArrow([-1.5, 2.5, 0], [-2.5, 1.5, 0], color=PINK)
        vvec3 = CurvedArrow([-1, 0, 0], [0, -1, 0], color=PINK)

        self.add(body, vvec1, vvec2, vvec3)


class mov7(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = (
            Polygram(
                [
                    [2, 1, 0],
                    [0, 1.5, 0],
                    [-1, 2, 0],
                    [-2, 1, 0],
                    [0, 0, 0],
                    [1, -1, 0],
                ],
            )
            .set_color(BLACK)
            .round_corners(radius=0.73)
        )

        pmz = Dot([1, 0, 0], color=RED, radius=0.08)

        vvec1 = CurvedArrow([1.5, 1.5, 0], [0.5, 2.5, 0], color=PINK)
        vvec2 = CurvedArrow([-1.5, 2.5, 0], [-2.5, 1.5, 0], color=PINK)
        vvec3 = CurvedArrow([-1, 0, 0], [0, -1, 0], color=PINK)

        tmz = MathTex(r"MZ", color=BLACK).move_to([1, 0.5, 0])

        self.add(body, vvec1, vvec2, vvec3, pmz, tmz)


class mov8(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = (
            Polygram(
                [
                    [2, 1, 0],
                    [0, 1.5, 0],
                    [-1, 2, 0],
                    [-2, 1, 0],
                    [0, 0, 0],
                    [1, -1, 0],
                ],
            )
            .set_color(BLACK)
            .round_corners(radius=0.73)
        )

        vl = Line([-2, 2, 0], [2.5, -1, 0], color=ORANGE)

        pmz = Dot([1, 0, 0], color=RED, radius=0.08)
        pp = Dot([-0.5, 1, 0], color=BLUE, radius=0.08)

        vvec1 = CurvedArrow([1.5, -0.5, 0], [0.5, 0.5, 0], color=PINK)
        vvec2 = Arrow([-0.5, 1, 0], [-1.5, -0.5, 0], color=PINK)

        tmz = MathTex(r"MZ", color=BLACK).move_to([1, 0.5, 0])
        tp = MathTex(r"P", color=BLACK).move_to([-0.5, 1.5, 0])

        tvvec2 = MathTex(r"\vec{v}_p", color=PINK).move_to([-1.5, -0.5, 0])

        self.add(body, vl, vvec1, vvec2, pmz, tmz, tp, pp, tvvec2)


class mov9(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        sk = Polygon(
            [-2, -1.5, 0], [1, -1.5, 0], [2, 1.5, 0], [-1, 1.5, 0], color=BLACK
        )

        pa = Dot([-2, -1.5, 0], color=RED, radius=0.08)
        pb = Dot([1, -1.5, 0], color=BLUE, radius=0.08)
        pc = Dot([2, 1.5, 0], color=GREEN, radius=0.08)
        pd = Dot([-1, 1.5, 0], color=ORANGE, radius=0.08)

        va = CurvedArrow([-0.5, -2, 0], [-0.5, -1, 0], color=PINK)
        vb = CurvedArrow([2, 0, 0], [1, 0, 0], color=PINK)
        vc = CurvedArrow([0.5, 1, 0], [0.5, 2, 0], color=PINK)
        vd = CurvedArrow([-1, 0, 0], [-2, 0, 0], color=PINK)

        ta = MathTex(r"A", color=BLACK).move_to([-2, -2, 0])
        tb = MathTex(r"B", color=BLACK).move_to([1, -2, 0])
        tc = MathTex(r"C", color=BLACK).move_to([2, 2, 0])
        td = MathTex(r"D", color=BLACK).move_to([-1, 2, 0])

        tva = MathTex(r"\omega_1", color=BLACK).move_to([-0.5, -2.5, 0])
        tvb = MathTex(r"\omega_2", color=BLACK).move_to([2.5, 0, 0])
        tvc = MathTex(r"\omega_3", color=BLACK).move_to([0.5, 2.5, 0])
        tvd = MathTex(r"\omega_4", color=BLACK).move_to([-2.5, 0, 0])

        self.add(sk, pa, pb, pc, pd, va, vb, vc, vd, ta, tb, tc, td, tva, tvb, tvc, tvd)


class mov10(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = (
            Polygram(
                [
                    [2, 1, 0],
                    [0, 1.5, 0],
                    [-1, 2, 0],
                    [-2, 1, 0],
                    [0, 0, 0],
                    [1, -1, 0],
                ],
            )
            .set_color(BLACK)
            .round_corners(radius=0.73)
        )

        vl1 = Line([-2, 2, 0], [2.5, -1, 0], color=ORANGE)
        vl2 = Line([0, 2.5, 0], [1.5, -1.25, 0], color=ORANGE)

        pmz = Dot([1, 0, 0], color=RED, radius=0.08)
        pa = Dot([-0.5, 1, 0], color=BLUE, radius=0.08)
        pb = Dot([0.5, 1.25, 0], color=GREEN, radius=0.08)

        vvec1 = CurvedArrow([1.5, -0.5, 0], [0.5, 0.5, 0], color=PINK)
        vvec2 = Arrow([-0.5, 1, 0], [-1.5, -0.5, 0], color=PINK)
        vvec3 = Arrow([0.5, 1.25, 0], [-0.875, 0.5, 0], color=PINK)

        tmz = MathTex(r"MZ", color=BLACK).move_to([1, 0.5, 0])
        ta = MathTex(r"A", color=BLACK).move_to([-0.5, 1.5, 0])
        tb = MathTex(r"B", color=BLACK).move_to([0.5, 1.75, 0])

        tvvec2 = MathTex(r"\vec{v}_A", color=PINK).move_to([-1.5, -0.5, 0])
        tvvec3 = MathTex(r"\vec{v}_B", color=PINK).move_to([-0.875, 0.5, 0])

        self.add(
            body,
            vl1,
            vl2,
            vvec1,
            vvec2,
            vvec3,
            pmz,
            tmz,
            ta,
            tb,
            pa,
            pb,
            tvvec2,
            tvvec3,
        )


class mov11(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        vl = DashedLine([-1.5, -1.5, 0], [1.5, 1.5, 0], color=ORANGE)

        pp = Dot([-0.5, -0.5, 0], color=RED)

        fvec1 = Arrow([-0.5, -0.5, 0], [0.5, 0.5, 0], color=PINK)

        pt = MathTex(r"P \text{: Angriffspunkt}", color=BLACK).move_to([1.5, -0.5, 0])
        fvec1t = MathTex(r"\vec{F} = F \cdot \vec{e}_F", color=PINK).move_to(
            [1.5, 0.5, 0]
        )

        self.add(vl, pp, fvec1, pt, fvec1t)


class mov12(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        fvec1 = Arrow([-2, -1.5, 0], [1, -1.5, 0], color=RED)
        fvec2 = Arrow([-2, -1.5, 0], [-1, 1.5, 0], color=BLUE)
        fvec3 = Arrow([-2, -1.5, 0], [2, 1.5, 0], color=GREEN)

        vl1 = DashedLine([-1, 1.5, 0], [2, 1.5, 0], color=ORANGE)
        vl2 = DashedLine([1, -1.5, 0], [2, 1.5, 0], color=ORANGE)

        pp = Dot([-2, -1.5, 0], color=BLACK, radius=0.08)

        pt = MathTex(r"P", color=BLACK).move_to([-2, -2, 0])
        fvec1t = MathTex(r"\vec{F}_1", color=BLUE).move_to([-2, 0, 0])
        fvec2t = MathTex(r"\vec{F}_2", color=RED).move_to([-0.5, -2, 0])
        fvec3t = MathTex(r"\vec{F}_3", color=GREEN).move_to([2, 1.5, 0])

        self.add(fvec1, fvec2, fvec3, vl1, vl2, pp, pt, fvec1t, fvec2t, fvec3t)


class mov13(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = Polygon([-1, -1, 0], [1, -1, 0], [1, 1, 0], [-1, 1, 0], color=BLACK)
        floor = Line(config.left_side, config.right_side, color=BLACK).move_to(
            [0, -1, 0]
        )

        fvec1 = Arrow([0, -1, 0], [0, -2, 0], color=RED)
        fvec2 = Arrow([0, -1, 0], ORIGIN, color=BLUE)

        fvec1t = MathTex(r"\vec{F}_G", color=RED).move_to([0, -2, 0])
        fvec2t = MathTex(r"\vec{F}", color=BLUE).move_to(ORIGIN)

        self.add(body, floor, fvec1, fvec2, fvec1t, fvec2t)


class mov14(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = Polygon([-1, -1, 0], [1, -1, 0], [1, 1, 0], [-1, 1, 0], color=BLACK)

        fvec1 = Arrow([1, 0, 0], [2, 0, 0], color=RED)
        fvec2 = Arrow([1, 0, 0], ORIGIN, color=BLUE)

        fvec1t = MathTex(r"\vec{F}_G", color=RED).move_to([2, 0, 0])
        fvec2t = MathTex(r"\vec{F}", color=BLUE).move_to(ORIGIN)

        self.add(body, fvec1, fvec2, fvec1t, fvec2t)


class mov15(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        vl = DashedLine([-1.25, -0.25, 0], [2.75, 1.75, 0], color=ORANGE)

        p0 = Dot([1.25, -1.5, 0], color=RED, radius=0.08)
        pp = Dot([0.75, 0.75, 0], color=BLUE, radius=0.08)
        ppp = Dot([0.25, 0.5, 0], color=GREEN, radius=0.08)

        vr = Arrow([1.25, -1.5, 0], [0.25, 0.5, 0], color=PURPLE)
        vf = Arrow([0.75, 0.75, 0], [2.75, 1.75, 0], color=PINK)

        p0t = MathTex(r"O", color=BLACK).move_to([1.25, -2, 0])
        ppt = MathTex(r"P", color=BLACK).move_to([0.75, 1.25, 0])
        pppt = MathTex(r"P'", color=BLACK).move_to([-0.25, 0.5, 0])
        vrt = MathTex(r"\vec{r}", color=PURPLE).move_to([1.25, -0.5, 0])
        vft = MathTex(r"\vec{F}", color=PINK).move_to([2.75, 1.75, 0])

        self.add(vl, p0, pp, ppp, vr, vf, p0t, ppt, pppt, vrt, vft)


class mov16(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        vl = DashedLine([-1.25, -0.25, 0], [2.75, 1.75, 0], color=ORANGE)

        p0 = Dot([1.25, -1.5, 0], color=RED, radius=0.08)
        pp = Dot([0.25, 0.5, 0], color=GREEN, radius=0.08)

        vr = Arrow([1.25, -1.5, 0], [0.25, 0.5, 0], color=PURPLE)
        vfp = Arrow([0.25, 0.5, 0], [2.25, 1.5, 0], color=PINK)
        vf = Arrow([0.25, 0.5, 0], [1.75, 2.5, 0], color=BLUE)

        p0t = MathTex(r"O", color=BLACK).move_to([1.25, -2, 0])
        ppt = MathTex(r"P", color=BLACK).move_to([-0.25, 0.5, 0])
        vrt = MathTex(r"\vec{r}", color=PURPLE).move_to([1.25, -0.5, 0])
        vfpt = MathTex(r"F \cdot r \cdot \cos(\alpha)", color=PINK).move_to(
            [2.75, 1.75, 0]
        )
        vft = MathTex(r"F", color=BLUE).move_to([1.75, 2.5, 0])

        self.add(vl, p0, pp, vr, vf, vfp, p0t, ppt, vrt, vfpt, vft)


class mov17(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = (
            Polygram(
                [
                    [2, 1, 0],
                    [0, 1.5, 0],
                    [-1, 2, 0],
                    [-2, 1, 0],
                    [0, 0, 0],
                    [1, -1, 0],
                ],
            )
            .set_color(BLACK)
            .round_corners(radius=0.73)
        )

        po = Dot([-2, -2, 0], color=BLACK, radius=0.06)
        pi = Dot([1, 1, 0], color=BLACK, radius=0.06)

        vri = Arrow([-2, -2, 0], [1, 1, 0], color=BLUE)
        vf1 = Arrow([1, 0, 0], [2, -1, 0], color=GREEN)
        vf2 = Arrow([0, 1, 0], [0, 2.5, 0], color=GREEN)
        vf3 = Arrow([-1, 1, 0], [-2, 0, 0], color=GREEN)
        vfi = Arrow([1, 1, 0], [2, 3, 0], color=RED)

        tri = MathTex(r"\vec{r}_i", color=BLUE).move_to([-0.5, -1, 0])
        tf1 = MathTex(r"\vec{F}_1", color=GREEN).move_to([2, -1, 0])
        tf2 = MathTex(r"\vec{F}_2", color=GREEN).move_to([0, 2.5, 0])
        tf3 = MathTex(r"\vec{F}_3", color=GREEN).move_to([-2, 0, 0])
        tfi = MathTex(r"\vec{F}_i", color=RED).move_to([2, 3, 0])
        tpo = MathTex(r"O", color=BLACK).move_to([-1.5, -2, 0])
        tpi = MathTex(r"P_i", color=BLACK).move_to([1.5, 1, 0])

        self.add(
            body, po, pi, vri, tri, vf1, vf2, vf3, vfi, tf1, tf2, tf3, tfi, tpo, tpi
        )


class mov18(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = (
            Polygram(
                [
                    [2, 1, 0],
                    [0, 1.5, 0],
                    [-1, 2, 0],
                    [-2, 1, 0],
                    [0, 0, 0],
                    [1, -1, 0],
                ],
            )
            .set_color(BLACK)
            .round_corners(radius=0.73)
        )

        p = Dot([0, 1, 0], color=BLACK, radius=0.06)

        wl1 = DashedLine([0, 1, 0], [2, 3, 0], color=ORANGE)
        wl2 = DashedLine([0, 1, 0], [2, 0, 0], color=ORANGE)
        wl3 = DashedLine([0, 1, 0], [-3, 1, 0], color=ORANGE)

        vf1 = Arrow([1.75, 2.75, 0], [0.75, 1.75, 0], color=GREEN)
        vf2 = Arrow([0.25, 0.875, 0], [1.25, 0.375, 0], color=GREEN)
        vf3 = Arrow([-1, 1, 0], [-2, 1, 0], color=GREEN)

        tp = MathTex(r"P", color=BLACK).move_to([0.5, 1, 0])
        tf1 = MathTex(r"\vec{F_1}", color=GREEN).move_to([1.75, 2.75, 0])
        tf2 = MathTex(r"\vec{F_2}", color=GREEN).move_to([1.25, 0.375, 0])
        tf3 = MathTex(r"\vec{F_3}", color=GREEN).move_to([-2, 1, 0])

        self.add(body, p, wl1, wl2, wl3, vf1, vf2, vf3, tp, tf1, tf2, tf3)


class mov19(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = (
            Polygram(
                [
                    [2, 1, 0],
                    [0, 1.5, 0],
                    [-1, 2, 0],
                    [-2, 1, 0],
                    [0, 0, 0],
                    [1, -1, 0],
                ],
            )
            .set_color(BLACK)
            .round_corners(radius=0.73)
        )

        p = Dot([0, 0.5, 0], color=BLACK, radius=0.06)

        vf1 = Arrow([0, 0.5, 0], [2, 1.5, 0], color=GREEN)
        vf2 = Arrow([0, 1.5, 0], [-2, 0.5, 0], color=GREEN)
        vr = Arrow([0, 0.25, 0], [0, 1.75, 0], color=BLUE)

        tp = MathTex(r"P", color=BLACK).move_to([0.5, 0.5, 0])
        tf1 = MathTex(r"\vec{F_1}", color=GREEN).move_to([2, 1.5, 0])
        tf2 = MathTex(r"\vec{F_2}", color=GREEN).move_to([-2, 0.5, 0])
        tr = MathTex(r"\vec{r}", color=BLUE).move_to([0, 1.75, 0])

        self.add(body, p, vf1, vf2, vr, tp, tf1, tf2, tr)


class mov20(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        wl = DashedLine([-3, -3, 0], [3, 3, 0], color=ORANGE)

        vfa = Arrow([-2, -2, 0], [-1, -1, 0], color=GREEN)
        vfb = Arrow([1, 1, 0], [2, 2, 0], color=GREEN)

        tfa = MathTex(r"\vec{F_A}", color=GREEN).move_to([-1, -1.5, 0])
        tfb = MathTex(r"\vec{F_B}", color=GREEN).move_to([2, 1.5, 0])

        self.add(wl, vfa, vfb, tfa, tfb)


class stat1(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = Polygon([-1, -1, 0], [1, -1, 0], [1, 1, 0], [-1, 1, 0], color=BLACK)
        floor = Line(config.left_side, config.right_side, color=BLACK).move_to(
            [0, -1, 0]
        )

        self.add(body, floor)


class stat2(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        dot1 = Dot([-2, 0.5, 0], color=BLACK)
        dot2 = Dot([2, 0.5, 0], color=BLACK)
        dot3 = Dot([4, 0.5, 0], color=BLACK)

        sk11 = Line([-2, 0.5, 0], [-3, 0.5, 0], color=BLACK)
        sk12 = DashedLine([-3, 0.5, 0], [-3.5, 0.5, 0], color=BLACK)
        sk21 = Line([-2, 0.5, 0], [-3, -0.5, 0], color=BLACK)
        sk22 = DashedLine([-3, -0.5, 0], [-3.5, -1, 0], color=BLACK)
        sk31 = Line([-2, 0.5, 0], [-1, 0.5, 0], color=BLACK)
        sk32 = DashedLine([-1, 0.5, 0], [-0.5, 0.5, 0], color=BLACK)
        sk41 = Line([-2, 0.5, 0], [-1, -0.5, 0], color=BLACK)
        sk42 = DashedLine([-1, -0.5, 0], [-0.5, -1, 0], color=BLACK)
        sk51 = Line([2, 0.5, 0], [1, 0.5, 0], color=BLACK)
        sk52 = DashedLine([1, 0.5, 0], [0.5, 0.5, 0], color=BLACK)
        sk61 = Line([2, 0.5, 0], [1, -0.5, 0], color=BLACK)
        sk62 = DashedLine([1, -0.5, 0], [0.5, -1, 0], color=BLACK)
        sk71 = Line([4, 0.5, 0], [5, 0.5, 0], color=BLACK)
        sk72 = DashedLine([5, 0.5, 0], [5.5, 0.5, 0], color=BLACK)
        sk81 = Line([4, 0.5, 0], [5, -0.5, 0], color=BLACK)
        sk82 = DashedLine([5, -0.5, 0], [5.5, -1, 0], color=BLACK)

        vf1 = Arrow([2, 0.5, 0], [2, 1.5, 0], color=GREEN)
        vf2 = Arrow([4, 0.5, 0], [3, 0.5, 0], color=GREEN)
        vf3 = Arrow([2, 0.5, 0], [3, 0.5, 0], color=GREEN)
        vf4 = Arrow([4, 0.5, 0], [4, -0.5, 0], color=GREEN)

        tf1 = MathTex(r"A_x", color=GREEN).move_to([3, 1, 0])
        tf2 = MathTex(r"A_y", color=GREEN).move_to([2, 1.5, 0])
        tf3 = MathTex(r"A_y", color=GREEN).move_to([4, -0.5, 0])

        ra = MathTex(r"\Rightarrow", color=BLACK).move_to([0, 0, 0])

        self.add(
            dot1,
            dot2,
            dot3,
            sk11,
            sk12,
            sk21,
            sk22,
            sk31,
            sk32,
            sk41,
            sk42,
            sk51,
            sk52,
            sk61,
            sk62,
            sk71,
            sk72,
            sk81,
            sk82,
            vf1,
            vf2,
            vf3,
            vf4,
            tf1,
            tf2,
            tf3,
            ra,
        )


class stat3(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        sk1 = Line([-3, -1, 0], [-1, 1, 0], color=BLACK)
        sk2 = Line([1, -1, 0], [3, 1, 0], color=BLACK)

        cvx1 = Arrow([-3, 0, 0], [-3, 1, 0], color=BLACK)
        cvy1 = Arrow([-3, 0, 0], [-2, 0, 0], color=BLACK)
        cvx2 = Arrow([1, 0, 0], [0, 1, 0], color=BLACK)
        cvy2 = Arrow([1, 0, 0], [2, 1, 0], color=BLACK)

        tvx1 = MathTex(r"x", color=BLACK).move_to([-3, 0, 0])
        tvy1 = MathTex(r"y", color=BLACK).move_to([-3, 1, 0])
        tvx2 = MathTex(r"x", color=BLACK).move_to([1, 0, 0])
        tvy2 = MathTex(r"y", color=BLACK).move_to([0, 1, 0])

        self.add(sk1, sk2, cvx1, cvx2, cvy1, cvy2, tvx1, tvx2, tvy1, tvy2)


class stat4(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        floor = Line([-6, -0.75, 0], [6, -0.75, 0], color=BLACK)

        pbody1 = Polygon(
            [-1.25, -0.75, 0], [-0.75, -0.75, 0], [-1, -0.25, 0], color=BLACK
        )
        ppivot1 = Dot([-1, -0.25, 0], color=BLACK)
        pbody2 = Polygon([1.25, -0.75, 0], [0.75, -0.75, 0], [1, -0.25, 0], color=BLACK)
        ppivot2 = Dot([1, -0.25, 0], color=BLACK)

        bsk1 = Line([-1, -0.25, 0], [1, -0.25, 0], color=BLACK)
        bsk2 = Line([1, -0.25, 0], [0.5, 0.75, 0], color=BLACK)
        bsk3 = Line([0.5, 0.75, 0], [-0.5, 0.75, 0], color=BLACK)
        bsk4 = Line([-1, -0.25, 0], [-0.5, 0.75, 0], color=BLACK)
        bsk5 = Line([0.5, 0.75, 0], [0, -0.25, 0], color=BLACK)
        bsk6 = Line([-0.5, 0.75, 0], [0, -0.25, 0], color=BLACK)
        bp1 = Dot([0, -0.25, 0], color=BLACK)
        bp2 = Dot([0.5, 0.75, 0], color=BLACK)
        bp3 = Dot([-0.5, 0.75, 0], color=BLACK)

        vv = Arrow([0.5, 0.75, 0], [0, 1.75, 0], color=RED)
        vo = CurvedArrow([-0.75, -0.75, 0], [-1.25, 0.25, 0], color=RED)

        tv = MathTex(r"\tilde{v}", color=RED).move_to([0.5, 1.25, 0])
        to = MathTex(r"\tilde{\omega}", color=RED).move_to([-0.5, -0.75, 0])

        pivot1 = VGroup(pbody1, ppivot1)
        pivot2 = VGroup(pbody2, ppivot2)
        sk = VGroup(bsk1, bsk2, bsk3, bsk4, bsk5, bsk6, bp1, bp2, bp3)

        self.add(floor, pivot1, pivot2, sk, vv, vo, tv, to)


class stat5(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        floor = Line([-6, -1.25, 0], [0, -1.25, 0], color=BLACK)

        pbody1 = Polygon(
            [-5.25, -1.25, 0], [-4.75, -1.25, 0], [-5, -0.75, 0], color=BLACK
        )
        ppivot1 = Dot([-5, -0.75, 0], color=BLACK)
        pbody2 = Polygon(
            [-1.25, -1.25, 0], [-0.75, -1.25, 0], [-1, -0.75, 0], color=BLACK
        )
        ppivot2 = Dot([-1, -0.75, 0], color=BLACK)

        bsk1 = Line([-5, -0.75, 0], [-1, -0.75, 0], color=BLACK)
        bsk2 = Line([-1, -0.75, 0], [-2, 1.25, 0], color=BLACK)
        bsk3 = Line([-2, 1.25, 0], [-4, 1.25, 0], color=BLACK)
        bsk4 = Line([-4, 1.25, 0], [-5, -0.75, 0], color=BLACK)
        bsk5 = Line([-4, 1.25, 0], [-3, -0.75, 0], color=BLACK)
        bp1 = Dot([-3, -0.75, 0], color=BLACK)
        bp2 = Dot([-2, 1.25, 0], color=BLACK)
        bp3 = Dot([-4, 1.25, 0], color=BLACK)

        vsf1 = Arrow([-3, -0.75, 0], [-2.5, 0.25, 0], color=GREEN)
        vsf2 = Arrow([-2, 1.25, 0], [-2.5, 0.25, 0], color=GREEN)

        bsk6 = Line([2.5, -0.75, 0], [3.5, 1.25, 0], color=BLACK)

        vsf3 = Arrow([2.5, -0.75, 0], [2, -1.75, 0], color=GREEN)
        vsf4 = Arrow([3.5, 1.25, 0], [4, 2.25, 0], color=GREEN)

        pivot1 = VGroup(pbody1, ppivot1)
        pivot2 = VGroup(pbody2, ppivot2)
        sk = VGroup(bsk1, bsk2, bsk3, bsk4, bsk5, bp1, bp2, bp3, vsf1, vsf2, vsf3, vsf4)

        self.add(floor, pivot1, pivot2, sk, bsk6)


class stat6(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        ground = Polygon(
            [-8, -1, 0],
            [8, -1, 0],
            [7, -7, 0],
            [-7, -7, 0],
            color=GREY,
            fill_color=GREY,
            fill_opacity=1,
        )

        body = Polygon(
            [-1, 1, 0],
            [1, 1, 0],
            [1, -1, 0],
            [-1, -1, 0],
            color=BLUE,
            fill_color=BLUE,
            fill_opacity=1,
        )

        velvec = Arrow(
            start=[-1, 1.5, 0],
            end=[1, 1.5, 0],
            color=RED,
        )
        fricvec = Arrow(
            start=[-0.75, -1, 0],
            end=[-3, -1, 0],
            color=YELLOW,
        )
        forcevec = Arrow(
            start=[0.75, 0, 0],
            end=[3, 0, 0],
            color=GREEN,
        )

        tvv = MathTex(r"\vec{v}", color=RED).move_to([0, 2, 0])
        tfrv = MathTex(r"\vec{F}", color=YELLOW).move_to([-2, -0.5, 0])
        tfov = MathTex(r"\vec{F}_R", color=GREEN).move_to([3.5, 0, 0])

        self.add(ground, body, velvec, fricvec, forcevec, tvv, tfrv, tfov)


class stat7(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        ground = Polygon(
            [-8, -1, 0],
            [8, -1, 0],
            [7, -7, 0],
            [-7, -7, 0],
            color=GREY,
            fill_color=GREY,
            fill_opacity=1,
        )

        slope = Line([-2, 1, 0], [2, -1, 0], color=BLACK)

        body = (
            Polygon(
                [-1, 1, 0],
                [1, 1, 0],
                [1, -1, 0],
                [-1, -1, 0],
                color=BLUE,
                fill_color=BLUE,
                fill_opacity=1,
            )
            .rotate(-26.56 * DEGREES, axis=[0.0, 0.0, 1.0], about_point=None)
            .move_to([0, 1.1, 0])
        )

        velvec = Arrow(start=[-0.5, 2.75, 0], end=[2, 1.5, 0], color=RED)
        fricvec = Arrow(start=[-1, 1, 0], end=[-3, 2, 0], color=YELLOW)
        forcevec = Arrow(start=[0.5, 0, 0], end=[2.5, -1, 0], color=GREEN)

        tvv = MathTex(r"\vec{v}", color=RED).move_to([2, 1.5, 0])
        tfrv = MathTex(r"\vec{F}_R", color=YELLOW).move_to([-3, 2, 0])
        tfov = MathTex(r"\vec{F}", color=GREEN).move_to([2.5, -1, 0])
        tv0 = MathTex(r"\vec{v} = 0", color=RED).move_to([2, 0.5, 0])

        self.add(ground, slope, body, velvec, fricvec, forcevec, tvv, tfrv, tfov, tv0)


class stat8(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        ground = Polygon(
            [-8, -1, 0],
            [8, -1, 0],
            [7, -7, 0],
            [-7, -7, 0],
            color=GREY,
            fill_color=GREY,
            fill_opacity=1,
        )

        slope = Line([-2, 1, 0], [2, -1, 0], color=BLACK)

        body = (
            Polygon(
                [-1, 1, 0],
                [1, 1, 0],
                [1, -1, 0],
                [-1, -1, 0],
                color=BLUE,
                fill_color=BLUE,
                fill_opacity=1,
            )
            .rotate(-26.56 * DEGREES, axis=[0.0, 0.0, 1.0], about_point=None)
            .move_to([0, 1.1, 0])
        )

        velvec = Arrow(start=[-0.5, 2.75, 0], end=[2, 1.5, 0], color=RED)
        fricvec = Arrow(start=[-1, 1, 0], end=[-3, 2, 0], color=YELLOW)
        forcevec = Arrow(start=[0.5, 0, 0], end=[2.5, -1, 0], color=GREEN)

        tvv = MathTex(r"\vec{v}", color=RED).move_to([2, 1.5, 0])
        tfrv = MathTex(r"\vec{F}_R", color=YELLOW).move_to([-3, 2, 0])
        tfov = MathTex(r"\vec{F}", color=GREEN).move_to([2.5, -1, 0])
        tv0 = MathTex(r"\vec{v} \neq 0", color=RED).move_to([2, 0.5, 0])

        self.add(ground, slope, body, velvec, fricvec, forcevec, tvv, tfrv, tfov, tv0)


class stat9(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        ground = Polygon(
            [-8, -1, 0],
            [8, -1, 0],
            [7, -7, 0],
            [-7, -7, 0],
            color=GREY,
            fill_color=GREY,
            fill_opacity=1,
        )

        slope = Line([-2, 1, 0], [2, -1, 0], color=BLACK)

        body = Circle(radius=1, color=BLACK).move_to([0.25, 1, 0])

        velvec = Arrow(start=[-0.5, 2.75, 0], end=[2, 1.5, 0], color=RED)
        fricvec = Arrow(start=[0, 0, 0], end=[-2, 1, 0], color=YELLOW)
        forcevec = Arrow(start=[0, 0, 0], end=[2, -1, 0], color=GREEN)

        tvv = MathTex(r"\vec{v}", color=RED).move_to([2, 1.5, 0])
        tfrv = MathTex(r"\vec{F}_R", color=YELLOW).move_to([-2, 1, 0])
        tfov = MathTex(r"\vec{F}", color=GREEN).move_to([2, -1, 0])

        self.add(ground, slope, body, velvec, fricvec, forcevec, tvv, tfrv, tfov)


class dyn1(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = Circle(radius=1, color=BLACK).move_to([0, 2, 0])

        pbody1 = Polygon([-0.25, 1.5, 0], [0.25, 1.5, 0], [0, 2, 0], color=BLACK)
        ppivot1 = Dot([0, 2, 0], color=BLACK)

        line = Line([1, 2, 0], [1, -2, 0], color=BLACK)
        m = Dot([1, -2, 0], color=BLACK, radius=0.1)

        vr = Arrow([0, 2, 0], [1, 2, 0], color=GREEN)
        vphi = CurvedArrow([0, 3.25, 0], [1.25, 2, 0], angle=-90 * DEGREES, color=RED)
        vx = Arrow([1, -2, 0], [1, -3, 0], color=BLUE)

        tr = MathTex(r"R", color=GREEN).move_to([0.5, 2.5, 0])
        tphi = MathTex(r"\phi", color=RED).move_to([1.5, 3, 0])
        tx = MathTex(r"x", color=BLUE).move_to([1.25, -2.5, 0])

        pivot1 = VGroup(pbody1, ppivot1)

        self.add(body, pivot1, line, m, vr, vphi, vx, tr, tphi, tx)


class dyn2(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        ground = Polygon(
            [-8, 6, 0],
            [-8, -6, 0],
            [-5, -6, 0],
            [-5, 6, 0],
            color=GREY,
            fill_color=GREY,
            fill_opacity=1,
        )
        shold = Line([-5, 0, 0], [-3, 0, 0], color=BLACK)
        ss1 = Line([-3, 0, 0], [-2.5, 0.5, 0], color=BLACK)
        ss2 = Line([-2.5, 0.5, 0], [-1.5, -0.5, 0], color=BLACK)
        ss3 = Line([-1.5, -0.5, 0], [-0.5, 0.5, 0], color=BLACK)
        ss4 = Line([-0.5, 0.5, 0], [0.5, -0.5, 0], color=BLACK)
        ss5 = Line([0.5, -0.5, 0], [1.5, 0.5, 0], color=BLACK)
        ss6 = Line([1.5, 0.5, 0], [2.5, -0.5, 0], color=BLACK)
        ss7 = Line([2.5, -0.5, 0], [3, 0, 0], color=BLACK)

        m = Dot([3, 0, 0], color=BLACK, radius=0.3)

        eb1 = DashedLine([1, 2, 0], [1, -2, 0], color=BLACK)
        eb2 = DashedLine([3, 2, 0], [3, -2, 0], color=BLACK)
        tdx = MathTex(r"\Delta x", color=BLACK).move_to([2, -2, 0])

        spring = VGroup(shold, ss1, ss2, ss3, ss4, ss5, ss6, ss7)
        extension = VGroup(eb1, eb2, tdx)

        self.add(ground, spring, m, extension)


class dyn3(Scene):
    def construct(self):

        self.camera.background_color = WHITE

        body = (
            Polygram(
                [
                    [2, 1, 0],
                    [0, 1.5, 0],
                    [-1, 2, 0],
                    [-2, 1, 0],
                    [0, 0, 0],
                    [1, -1, 0],
                ],
            )
            .set_color(BLACK)
            .round_corners(radius=0.73)
        )

        po = Dot([-2, -2, 0], color=BLACK, radius=0.06)
        pdm = Dot([1, 1, 0], color=BLACK, radius=0.06)
        pc = Dot([0, 0.75, 0], color=BLACK, radius=0.06)

        vr = Arrow(
            [-2, -2, 0], [1, 1, 0], color=BLUE, max_tip_length_to_length_ratio=0.05
        )
        vroc = Arrow(
            [-2, -2, 0], [0, 0.75, 0], color=BLUE, max_tip_length_to_length_ratio=0.07
        )
        vv = Arrow([0, 0.75, 0], [1, 1, 0], color=RED)
        vrp = Arrow([1, 1, 0], [2, 1.5, 0], color=GREEN)
        vvoc = Arrow([0, 0.75, 0], [-1, 0.25, 0], color=GREEN)

        tr = MathTex(r"\vec{r}", color=BLUE).move_to([-0.5, -1, 0])
        troc = MathTex(r"\vec{r}_{OC}", color=BLUE).move_to([-1.5, -0.5, 0])
        tvoc = MathTex(r"\vec{v}_{OC}", color=GREEN).move_to([-1, 0.25, 0])
        trp = MathTex(r"\vec{r}'", color=RED).move_to([0.5, 1.25, 0])
        tv = MathTex(r"\vec{v}", color=GREEN).move_to([2, 1.5, 0])
        tpo = MathTex(r"O", color=BLACK).move_to([-1.5, -2, 0])
        tpdm = MathTex(r"dm", color=BLACK).move_to([1, 1.5, 0])
        tpc = MathTex(r"C", color=BLACK).move_to([0, 1.25, 0])

        self.add(
            body,
            po,
            pdm,
            pc,
            vr,
            vroc,
            vv,
            vrp,
            vvoc,
            tpo,
            tpdm,
            tpc,
            tr,
            troc,
            tvoc,
            trp,
            tv,
        )
