Two-disk Hypotrochoid Generator in Python

After picking up a little spirograph kit at the dollar store and playing around with it for a while, I wondered what it would be like if a second disk could rotate around the first disk. This not being physically possible, I decided it’d be a good time to practice my Python as well. After a couple evenings of fiddling, I was able to come up with some nice-looking images using just the math library and Python Imaging Libary.

Here’s the first image that was successfully generated. I stopped drawing prematurely so there are gaps, and the simulated disk was actually rotating the opposite way than a physical spirograph disk would.

hypotrochoid 1

Continue reading