Mathematics of Spirograph

Polar, sinusoidally based curves are attractive. If you enjoy ones similar to Spirograph, and who doesn't? :-), here is code to create the above curves. The rightmost is called a Maurer rose.

The curves above are created by running:

spiro.py -t h -R 17 -r 10 -d 9 -w 300 -c blue   -f blue.png
spiro.py -t h -R 29 -r 17 -d 7 -w 300 -c red    -f red.png
spiro.py -t h -R 13 -r 11 -d 5 -w 300 -c green  -f green.png
spiro.py -t h -R 13 -r  4 -d 2 -w 300 -c orange -f orange.png
spiro.py -t m -p 5 -s 97 -f rose.png
  

The cryptic looking arguments mean: