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.

Here I successfully simulated a standard physical spirograph and used some nicer colors.

Here’s a result I got after trying out some different coloring methods. I think this one alters the color based on the radians used to rotate one of the disks.

Here’s my first attempt at simulating a second disk rotating around the first disk. Pretty chaotic.

This last one is my favorite image that I’ve been able to come up with, simulating a 2nd disk rotating around the first disk. The rate of rotation and other parameters really make the difference between fantastic and terrible.

It’s sloppy and not very fast, but it works. Simulating circular disks was a fairly simple affair, but simulating a triangular, square, or football shaped disk would be significantly harder.

Code found here.

### Like this:

Like Loading...