Cycloid¶
In geometry, a cycloid is the curve traced by a point on a circle as it rolls along a straight line without slipping. A cycloid is a specific form of trochoid and is an example of a roulette.
Setup¶
Create a new Colab notebook at colab.new and run the cells below.
The session will restart to apply changes.
%pip install mscene
import mscene
%mscene -l manim plugins
from mscene.manim import *
from mscene.plugins import *
Actions¶
The trochoid_scene
function animates cycloid or trochoid scenes. A cycloid is a special case of trochoid where the tracing point is on the circumference of the rolling circle.
def trochoid_scene(scene, title, markers):
length = config.frame_width * 0.75
radius = length / (2 * TAU)
num_line = NumberLine(
x_range=[-TAU, TAU, PI], length=length, color=ManimColor("#6F828A")
).shift(DOWN * radius)
point = num_line.n2p(-TAU) + radius * UP
wheel = Wheel(radius=radius, color=ManimColor("#04D9FF"), point=point)
scene.play(GrowFromCenter(wheel), Create(num_line, lag_ratio=0))
scene.wait()
scene.play(wheel.draw_markers(markers), Write(title))
scene.wait()
path = wheel.trace_paths()
scene.add(path)
scene.play(wheel.roll(length * RIGHT, run_time=4))
scene.wait()
path.clear_updaters()
scene.play(path.animate.fade(2 / 3))
new_path = wheel.trace_paths(dissipating_time=2)
scene.add(new_path)
scene.play(wheel.roll(length * LEFT, run_time=4))
scene.wait()
scene.play(Unwrite(title), FadeOut(path))
new_path.clear_updaters()
scene.wait()
scene.remove(new_path)
scene.play(wheel.undraw_markers(), Unwrite(title))
scene.wait()
scene.play(ShrinkToCenter(wheel), Uncreate(num_line, lag_ratio=0))
scene.wait(0.5)
Scenes¶
Cycloid¶
%%manim -qm Cycloid
class Cycloid(Scene):
def construct(self):
title = Text("Cycloid").to_edge(DOWN, buff=1.25)
marker = [(1, PI / 2, ManimColor("#6019E3"))]
trochoid_scene(self, title, marker)
Prolate Cycloid¶
%%manim -qm ProlateCycloid
class ProlateCycloid(Scene):
def construct(self):
title = Text("Prolate Cycloid").to_edge(DOWN, buff=1.25)
marker = [(1.5, PI / 2, ManimColor("#E31937"))]
trochoid_scene(self, title, marker)
Curtate Cycloid¶
%%manim -qm CurtateCycloid
class CurtateCycloid(Scene):
def construct(self):
title = Text("Curtate Cycloid").to_edge(DOWN, buff=1.25)
marker = [(0.5, PI / 2, ManimColor("#19E360"))]
trochoid_scene(self, title, marker)
Two Markers¶
%%manim -qm TwoMarkers
class TwoMarkers(Scene):
def construct(self):
title = VMobject()
marker = [
(1, PI / 2, ManimColor("#6019E3")),
(0.5, -PI / 2, ManimColor("#E31937")),
]
trochoid_scene(self, title, marker)
Trochoids¶
%%manim -qm Trochoids
class Trochoids(Scene):
def construct(self):
colors = [ManimColor(hex) for hex in ("#19E360", "#6019E3", "#E31937")]
cycloids = [
("Curtate Cycloid", (0.5, PI / 2, colors[0])),
("Cycloid", (1, PI / 2, colors[1])),
("Prolate Cycloid", (1.5, PI / 2, colors[2])),
]
title = VGroup()
markers = []
for i in cycloids:
text = Text(i[0], font_size=40)
dot = Dot(radius=0.125, color=i[1][2]).next_to(text[0], LEFT)
title.add(VGroup(dot, text))
markers.append(i[1])
title.arrange(RIGHT, buff=0.5).to_edge(DOWN, buff=1.25)
markers.reverse()
trochoid_scene(self, title, markers)