Spirograph Gear Lab (2D)

Choose a ring or disc and a wheel from a real gear set and a pen hole: the pen traces a hypotrochoid or epitrochoid that closes after N2/gcd turns with N1/gcd lobes.

Presets

Playback

Gears and pen

Drawing

Layers

Model check

The science

The mechanism

A Spirograph is a toothed wheel with N2 teeth that meshes with a fixed gear with N1 teeth, and a pen that sits in one of the wheel's holes. Because the teeth mesh, the wheel rolls without slipping: the arc it rolls along the fixed gear equals the arc it unrolls from its own rim. With pitch radii R = N1 and r = N2 (in units of half a tooth module) and a pen at distance d from the wheel centre:

Inside a ring (hypotrochoid): z(t) = (R − r) eit + d e−i k t, k = (R − r)/r. Around a disc (epitrochoid): z(t) = (R + r) eit + d e+i k t, k = (R + r)/r. Here t is the angle of the arm that joins the fixed centre to the wheel centre. With the pen on the rim (d = r) these are the hypocycloid and epicycloid, whose cusps touch the fixed gear with zero speed.

Lobes and closure

The curve closes when both rotating terms have returned to their start. With g = gcd(N1, N2) the arm must turn N2/g times and the figure has N1/g lobes (maxima of |z|). So a 96-tooth ring with a 32-tooth wheel gives a three-lobed shape in one turn, while a 105-tooth ring with a 52-tooth wheel (coprime) needs 52 turns for 105 lobes. The last graph lists the lobe count for every wheel in the set.

Area and speed

For z = A ei t + B ei β t the signed area is ½ ∮ Im(z̄ dz). The cross terms oscillate and integrate to zero over the closing period T = 2π N2/g, leaving Area = ½ (A2 + β d2) T with A = R ∓ r and β = −k (hypo) or +k (epi). Overlapping loops are counted with their winding number, which is why the area can exceed the visible footprint. The pen speed is |z'(t)|.

Honest simplifications

The wheel is drawn with simplified trapezoid teeth and the pen holes are placed on a fixed spiral; the tooth phase of the wheel is not matched to a particular tooth of the ring (a real set meshes at discrete positions, which only shifts the figure's starting angle). Real plastic sets also have a little backlash and pen compliance, which are ignored. The figures here are exact mathematics of an ideal rolling gear, not a model of ink on paper.

Model checks in this page

(1) the shoelace area of the traced polygon equals the closed form above for three gear/hole combinations; (2) counting the maxima of the pen radius gives N1/gcd lobes and the path returns to its start after N2/gcd turns; (3) the marked tooth of the wheel touches the fixed gear at radius N1 with zero speed, which is the no-slip condition.

Pen distance from the centre: lobes are the maxima
Pen speed: cusps appear where it falls to zero
Swept signed area against the closed form
Lobes in the figure for every wheel of the set