Monday, 13 January, 2003
I think every kid had a Spirograph when I was growing up. I know that I spent countless hours with my colored pens and those little plastic pieces, trying to overlap figures in different ways to make beautiful designs. I'd pretty much forgotten about Spirograph until 1995, when my friend and co-author Jeff Duntemann wrote a program he called "Spiromania" for our book Delphi Programming Explorer. I converted the program to C++ for The C++Builder Programming Explorer, and have played with it from time to time since, even toying with it when I was learning about writing Windows screen savers. I'm at it again, but this time with completely new code written in C#. It's a project for learning .NET programming.
One of the cool things about computers is that you can simulate things that you just can't do with a physical model. For example, the two figures shown above were created by simulating a circle of radius 60 rolling around a circle of radius 29, and the pen on the edge of the bigger circle. The only difference is that the figure on the left is drawn with smooth curves—which is what you'd get with a real Spirograph toy—and the figure on the right is drawn by plotting 5 points for each time the big circle goes around the little circle. (In actuality, the figure on the left also is drawn using straight lines, but the lines are sufficiently short to give the illusion of smooth curves.) In any case, the figure on the right would be impossible (well, okay, exceedingly difficult) to create using a physical Spirograph toy.
I've written a .NET custom control so I can drop these things on a form and fiddle with their properties. I'm working now on some animation and a little better user interface, and eventually will have a program that will allow you to create and manipulate multiple images, moving them around and overlapping them. It's great way to learn a new programming environment.