How to use it
Press Play and a small toothed wheel rolls round the inside of a fixed ring while a pen in one of its holes draws a curve. A finished curve stays on the paper as a layer, so you can change the gears, pen hole, colour or rotation and draw the next one on top. If you want pictures straight away, open a preset, press Random or let Auto pattern draw a whole rosette.
Controls
- Play, Step, Finish instantly: Play rolls the wheel, Step advances it by one tooth, Finish instantly draws the rest of the curve at once.
- Undo and Clear: Undo removes the last finished curve and restores its settings. Clear empties the paper, and Undo brings it back once.
- Ring teeth N and wheel teeth n: use the sliders or the real-toy tooth counts. Rolling inside needs a wheel smaller than the ring, because it has to fit; Outside has no such limit.
- Pen hole: a fraction of the wheel radius, from 0.1 near the centre to 1.5 beyond the rim. Hole 1 is on the rim, hole 10 near the centre.
- Rotation and Inside/Outside: rotation turns the whole drawing, and Inside or Outside chooses whether the wheel rolls in the ring or around it.
- Pen and paper: colour, width, opacity, rainbow, dark or light paper.
- Mouse, touch, keyboard: drag on the canvas to roll the wheel by hand, even backwards. With the canvas focused, Space plays or pauses, the period key and arrow keys move the wheel, F finishes the curve.
- Save PNG, Save SVG, Copy link: PNG can be transparent, SVG keeps every curve as a vector path, and the link rebuilds your layers anywhere.
How it works
This is a roulette: the curve traced by a point fixed to one curve while it rolls without slipping along another. Let the fixed ring have radius R and the wheel radius r, both proportional to their tooth counts, and let the pen sit at distance d from the wheel centre. Rolling inside gives a hypotrochoid, rolling outside an epitrochoid:
Outside: x = (R + r) cos t − d cos((R + r)t / r), y = (R + r) sin t − d sin((R + r)t / r)
Here t is the angle of the line from the ring centre to the wheel centre. With N ring teeth, n wheel teeth and g = gcd(N, n), the curve closes when the same teeth meet again. That takes the least common multiple of N and n teeth, so the wheel goes round the ring n / g times (t runs from 0 to 2πn / g). In that time the pen reaches its outermost points N / g times, which is the number of petals. For N = 96 and n = 36, g = 12, so you get 8 petals and 3 laps. If N and n share no factor, you get N petals and n laps.
A pen on the wheel rim gives a hypocycloid inside and an epicycloid outside. If N = 2n and the pen is on the rim, the curve collapses to a straight line, the Tusi couple. N = 3n gives the three-cusped deltoid and N = 4n the four-cusped astroid. With N = 2n and the pen off the rim you get an ellipse, and a pen at the centre draws a circle.
Such curves are everywhere: the housing of a rotary piston engine is an epitrochoid, and the guilloche patterns on banknotes and watch dials are engraved by machines that combine circular motions.
Things to try
- Set N = 96, n = 36, hole 0.7, count the petals and compare with the readout (8).
- Put the pen on the rim (hole 1) with wheel 32 in ring 96 for a deltoid, or wheel 24 for the astroid.
- Set N = 96, n = 48 and drag the hole from 1.0 towards 0.5: the straight line opens into an ellipse.
- Pick coprime sizes such as 105 and 52: the wheel makes 52 laps before the curve closes.
- Press Auto pattern with rotation stepping for a classic rosette, then try hole stepping.
Frequently asked questions
Why does my curve take so many laps to close?
When the tooth counts share a large factor the curve closes quickly. When they are nearly coprime the wheel laps the ring up to n times, because the same teeth only meet again after the least common multiple of N and n teeth.
Why is the drawing almost a circle?
A pen near the wheel centre barely moves relative to the wheel, so it follows the centre, which travels on a circle of radius R − r. Move the hole outwards to see petals.
Can I draw with a pen hole beyond the rim?
Yes, up to 1.5 times the wheel radius. The maths is the same with d larger than r, and the curve gains loops. A real wheel has no holes there.
Is it exactly like a real gear toy?
It is the ideal version, with perfect rolling and no play between teeth. Real drawings differ slightly, but the shapes follow the same equations.
Sources
- MacTutor History of Mathematics, University of St Andrews (accessed 25 October 2026). Hypotrochoid. The inside equation above; their a, b and c are R, r and d.
- MacTutor History of Mathematics, University of St Andrews (accessed 25 October 2026). Epitrochoid. The outside equation above, with the same letters.