Cycloids

Learn how a circle rolls along a straight line, creating a cycloid, and explore its variations: epicycloid and hypocycloid, formed when they roll along the outside or inside edge of another circle. Roll circles in different configurations to draw various cycloidal curves and visualize the intriguing patterns. Simulate to study the applications of these fascinating curves in multiple fields, including mathematics, physics, and engineering. Perfect for anyone curious about the geometry of rolling circles.

Open in Colab

Setup

Visit colab.new to create a new Colab notebook.

Installation

The session will restart to apply changes.

%pip install -q mscene
import mscene
%mscene -l manim plugins

Imports

roulette is included in the plugins.

from mscene.manim import *
from mscene.roulette import *

Scenes

Cycloid

cycloid

Epicycloid

epicycloid

Hypocycloid

hypocycloid
%%manim -qm Cycloids

class Cycloids(Scene):
    def construct(self):
        radius = 0.8
        length = TAU * radius

        circle_one = Circle(radius=radius, color=ManimColor("#C5C9C7")).rotate(PI / 2)

        circle_two = Circle(radius=3 * radius, color=ManimColor("#C5C9C7")).rotate(
            PI / 2
        )

        line_end = circle_two.get_bottom()
        line_start = line_end + length * LEFT

        line = Line(line_start, line_end, color=ManimColor("#C5C9C7"))

        wheel = Wheel(radius=radius, color=ManimColor("#04D9FF"))

        self.play(GrowFromCenter(wheel))
        self.wait()

        self.play(Create(line), wheel.animate.move(line_start, UP))
        self.bring_to_front(wheel)

        marker = [(1, PI / 2, ManimColor("#6019E3"))]
        self.play(wheel.draw_markers(marker))

        path = wheel.trace_paths(dissipating_time=2)
        self.add(path)

        # rolls along the line
        self.play(wheel.roll(length * RIGHT, run_time=2.5))
        self.wait()

        self.play(ReplacementTransform(line, circle_one))
        self.wait()

        # rolls along the outer edge of circle one
        self.play(wheel.roll(TAU, about=circle_one, run_time=2.5))
        self.wait()

        self.play(ReplacementTransform(circle_one, circle_two))
        self.wait()

        # rolls along the inner edge of circle two
        self.play(wheel.roll(TAU, about=circle_two, run_time=3))
        self.wait(2)
        path.clear_updaters()
        self.remove(path)
        self.play(wheel.undraw_markers())

        self.play(Uncreate(circle_two), wheel.animate.move(ORIGIN))
        self.wait()

        self.play(ShrinkToCenter(wheel))
        self.wait(0.5)