Name: Spirograph (plug-in) or spirograph (JWildfire version)

Type: 2D shape

Author: Jed Kelsey (Lu-Kout)

JWildfire: Yes

Link: http://lu-kout.deviantart.com/art/Apophysis-Plugin-Pack-1-v0-4-59907275

Spirograph is a 2D shape variation that generates figures based on the Spirograph toy, where a plastic gear with multiple holes for a pen is rotated around either the outside of another fixed disk the inside of a fixed ring. Mathematically, the figures are called epitrochoids or hypotrochoids (when the disk is rotated around the outside or inside, respectively). The input point (and thus the pre-affine transform) is ignored; use the post-affine transform to move or rotate the resulting figure.

Spirograph figures typically have a number of pointy loops arranged in a circle. These loops point inward for epitrochoids and outward for hypotrochoids. Here are examples:

The details of the spirograph figure are controlled by the following parameters:

variation value | Sets the overall size of the figure; 1 is a typical value. |

a | Radius of the fixed circle. It should be positive and relatively small; the default value of 3 is much too large. As a rule of thumb, the sum of a and b should be around 1. Use the variation value to control the exact size. |

b | Radius of the rotating circle. Make it positive for an epitrochoid (rotating around the outside) or negative for a hypotrochoid (rotating around the inside). The absolute value is generally smaller than a, though this is not required. It must not be 0. The default value of 2 is too large. |

c1, c2 | The distance from the center of the rotating circle where the pen is located. They are normally equal, but may be different to achieve special effects. The default value of 0 will result in a circle. |

d | Normally set to 0 (the default). Other values modify the figure but not in a way that creates something new which can’t be obtained by modifying the other values. |

tmin, tmax | The minimum and maximum values for t, the parametric equation parameter. The default values of -1 and 1 do not give it a large enough range. More reasonable values are 0 and 1000. |

ymin, ymax | Set both to 0 for a normal line. For an effect resembling using a pen with a flat nib, set ymin to a small negative value (half the width of the nib) and ymax to the corresponding positive value. The default values of -1 and 1 result in a very, very thick line; this might be useful as a special effect, but is not typical for a spirograph figure. |

Multiplying a, b, c1, c2, and d by the same value will scale the figure by that value, but will not change its shape. It’s easier to adjust the size using the variation value, but this property is helpful in analyzing the figures.

The number of loops is controlled by the ratio of a and b, or the fraction a/b (it will be an improper fraction since a is usually larger than b). Shift the decimal point for both a and b to the right enough times so that both a and b are integers, then divide a and b by their greatest common factor to get a reduced (but still improper) fraction. The numerator will be the number of loops in the figure, and the denominator will specify how many loops away successive loops in the path are. For example, in the figures above, a is 1.0 and b is 0.3. So a/b is 1.0/0.3; shifting the decimal right once we get 10/3, which is reduced. So there are 10 loops total and the path traces loops that are 3 loops apart.

Here are some examples:

The size of the loops is controlled by c1 and c2. Keep them the same for true epitrochoids or hypotrochoids. If they are equal to b, the loops are points. (The figures in this special case are also called epicycloids or hypocycloids.) Values closer to 0 produce points that are wider and softer, the outside shrinks, and the inside grows; at 0 the figure is a circle. As the values get further from 0, the points become loops, the outside grows, and the inside shrinks, until c1 and c2 reach the special value a+b, when the loops meet at the center. Past this value, both the inside and outside grow and the loops widen. Here are examples of increasing values of c with a=1 and b=-0.45. The special case c1=c2=b is at top right, and the special case c1=c2=a+b is bottom middle. The scale is the same for all six figures.

If c1 and c2 are different but have the same sign, the figure gives the appearance of a three dimensional figure being tilted. But it is just an illusion; spirograph is strictly a two dimensional variation. (But this inspired the spirograph3D variation, which makes true three dimensional figures.) Here is an example with a=1, b=-0.46, and c1=0.6, with decreasing values of c2.

But going beyond 0 does not continue this sequence. If c1 and c2 have different signs, the figure changes from an epitrochoid to a hypotrochoid or vice versa. Indeed, a note by the author suggests giving c1 and c2 opposite signs to make a hypotrochoid. Although that does work, the values of a and b no longer represent the radii of the circles, making it harder to predict the results. Giving c1 and c2 the same sign and making b negative to make a hypotrochoid is more intutive and a lot easier to analyze.

You don’t need to understand the mathematics to make spirograph patterns, but for those interested, spirograph uses the following parametric equations (t is the parameter, set to a random value between tmin and tmax):