Applet
Explanation

The form drawn by the applet is a hypotrochoid, or spirograph. A hypotrochoid is a relative of a cycloid. The cycloid, a simpler form, is generated by tracking a point on a circle as the circle rolls along a straight line. A cycloid looks like a series of hops. The hypotrochoid is a cycloid that's been made inside a circle instead of on a straight line. In addition there's an offset parameter that places the point that is traced off of the circumference of the rolling circle.

The parametric equation for the hypotrochoid is as follows:

Where R is the radius of the circle around which the rolling circle rolls, r is the radius of the rolling circle, and O is the distance of the traced point from the circumference of the rolling circle. Each parameter is graphically represented as a dot that you can click and drag. The effect of your movements are reflected in the numeric display at the upper left.

The really interesting stuff occurs with very small values for r and very large values for O but this is not because those are interesting hypotrochoids, it's just a rendering artifact. The applet draws a line between each sample point, and when the sample points are not close enough together you get jagged lines instead of smooth curves. But, hey, it still looks cool.

Wolfram provides a great discussion that will probably give away how I got the idea for the applet.

Here's another applet that also helped me out a lot.

Code

The source code was developed in the Proce55ing development environment.