Spirograph Emulator: Executable or Text Version
Visual C# version: Executable or Text Version
Visual C# Multiple Spirograph: Executable
If you're as old as me, you'll remember a toy called SPIROGRAPH. The original version consisted of patterns made by putting a pen through a hole in a toothed wheel, and rolling it around the inside of a larger wheel.
Mathematically, it's a CYCLOID curve rolling around on the inside of a circle, rather than on the flat.
A cycloid is the curve a bicycle valve makes as a bicycle wheel rolls along the road. If "R" is the radius of the big wheel, "r" is that of the small wheel, "rm" is the modified radius as far where the pen pokes through a hole, and "phi" is the angle through which the smaller wheel has rotated, then the x and y positions on screen are given by;
X = (R-r)*sin(r*phi/R) - rm*sin[(1-r/R)*phi]
Y = -(R-r)*cos(r*phi/R) - rm*cos[(1-r/R)*phi]
Solid Spirograph: Executable or Text Version
An example of the result from this program is shown below.