Today I thought it would be fun to create shapes by writing a program that computes and then draws one continuous line — sort of a mathematical Etch-a-Sketch or Spirograph. This is actually the oldest idea in computer graphics, since John Whitney pretty much started the field of computer animation over half a century ago by doing something like this.
My goal was to see whether some very simple rule could produce a large variety of beautiful shapes. I didn’t have any specific approach in mind, other than this general idea. I tried all kinds of different things this evening, and the result I liked best was a little program that lets you create a very large variety of shapes, including all of the shapes below, by moving your mouse around:
Looking at all these lovely forms, I feel as though I’ve stumbled across some mathematical Burgess Shale. Or maybe this is just a single fabulous creature who lives in some higher dimensional space. Perhaps it looks to us like different creatures because it keeps turning in various directions, as it swims around in its high dimensional world.
I suspect there are many more shapes to be found in my program. You can click on the image above to find them for yourself.
The recipe is very simple:
x = y = θ = 0
Repeat 8000 times: x2
x += cos θ / 10 x2
y += sin θ / 10 x2
θ += ( (x2q)p + (y2/q)p ) / 20
When you move your mouse, you are varying p and q.