From Schoolcoders wiki

A hypotrochoid is a curve traced by a point attached to a circle of radius b rolling around the inside of a fixed circle of radius a, where the point is a distance d from the center of the interior circle. This is the type of curve traced by a Spirograph toy.

Here is an example:



The curve can be described by a pair of parametric equations:




Range of parameter t

As the value of parameter t changes, the values of x(t) and y(t) change. As t increases in value, the point (x, y) traces out the hypotrochoid curve. At a certain point, the point (x, y) reaches its initial position, and the curve repeats.

If we want to create a plot of the curve, it is useful to know what range of t we should use to produce one complete cycle.

In fact, t measures how far the red circle has rolled around the inside of of the outer circle. This is measured as an angle in radians. As t increases from 0 to 2π, the red circle rolls all the way around the inside of the outer circle, back to its starting position However, that doesn't represent a full cycle of the hypotrochoid curve. Here is what the curve looks like when t equals 2π:


As you can see, although the red circle has rotated around to its original position, the curve is not complete. If you watch the animation above carefully, you will notice that the red circle rotates around the inside of the outer circle three times before the curve is complete.

The number of rotations depends on parameters a and b. It is equal to:

   b / gcd(a, b)

where gcd(a, b) is the greatest common divisor of a and b.

See also