## Spirographs and the third dimension

The basic geometric ideas are straight lines and circles. The famous compass and straight edge. There is a great deal that can be done with just these, but what if you want something more complex? Spirographs are a very simple idea, let one circle run around a second. You can make the circles as cogs and then you get a classic toy. In mathematics there is a mess of names to describe the curves produced, I shall just list them, understanding the differences is a good way of learning the subject: epicycloid, hypocycloid, epitrochoid, hypotrochoid. It is easy to find lots of examples of these curves online.

So where can we go to generalise. The first trick is to add more circles. Adding circles like this gave one of the first predictive models of the planets as they move in their strange paths across the sky. Unfortunately if you add enough circles you can actually get any curve you want, so the method could never be disproved, though it was eventually replaced starting with the brilliance of Copernicus who put forward a model of the solar system with the sun at the center. To make images with more than two circle you obviously need a more complicated device as the circles might bump into each other (just think of three cogs). Luckily humanity was up to the challenge and produced the geometric chuck.

Now we want to go further, to try to make similar figures in 3d. The first step is to get tools we can play with more easily than simply describing the geometry. We need a more algebraic form that we can give to the computer, and some way of simply describing the circles. The geometry comes first. Here are the cogs:

The sizes of the two cogs show how fast they go round each other. In this case, we have a cog with 30 pegs and a cog with 10. The smaller cog will therefore go round 3 times every time it goes once round the big cog. We now look at the red point on the smaller cog and watch it move along the green line. How do we model this?

Firstly lets consider circles. We have the circles for the two cogs, but these are not very useful. We can look instead at the grey circle. The centre of the small cog moves round this circle. The black circle on the small cog then shows how the red dot moves. The final position is the position on the two circles added together. To plot the curve we need to consider both circles moving round. If we let the big circle go round once, the small circle will go round four times (once for the large circle rotating and three going round the large circle). We also need to know the sizes of the two circles, in this case 5 and 1 (I will not give units as only the relative sizes effect the shape). The path given by these cogs can therefore be encoded as (1,5) + (4,1).

Now recall the parametric formula for a circle: , for x between 0 and . This equation allow a computer to draw a circle as we put in values of x and plot the point in 2d. Adding the two circles together therefore we get a parametric formula:

Note how we would just get the points in the circle repeated four times from the second part , were it not for the addition. We can therefore consider epicycles as adding circles of different radii, moving at different speeds, together.

Finally we can get to the title and leap to 3d. We can have circles in 3d, so lets add them together. We have an additional problem however. Circles are flat, so the same circle can be put in 3d at different angles, we must also consider the plane in which each circle lies. If we put all circles in the same plane we are stuck in 2d, so where can we put them?

One simple solution is to put the three circles on the faces of a cube:

There is something unsatisfying about these curves. For one thing the circles moving on faces reminds more of Lissajous curves rather than spirographs. Although we are adding circles it is hard to see where the cogs might be. Maybe another approach is required. A different approach would be to consider cogs with 45 degree angles. In other words one gear is at right angles to the previous one:

Each circle other than the first now moves on a plane that itself is moving, staying at right angles to the plane of the previous circle. It takes a bit of thinking to work out what is happening! So lets cut to two more items from my mathematical museum of dreams:

Even better a real version (the work of Richard Grimes):

[Update: 15/1/10 Daniel Piker has a beautiful animation showing how the circles move for yet another version of the 3d spirograph]

So far we have assumed that we take circles in 2d to circles in 3d. Is this the only analogue of a circle? The circle is a one dimensional object. In two dimensions, therefore it has one less dimension than the space. Perhaps we can consider two dimensional objects when we go to three dimensions. There are two natural two dimensional generalisations of the circle: the sphere and the torus (donut). The torus can be thought of one circle moved round a second, as you can see here the red circles can be moved round the blue circle to make the torus:

As the torus is made up of circles it is perhaps more natural in this setting. We then have five pieces of information to describe a torus. The radii of the two circles and the speed at which we travel round them plus (as with circles) the plane the larger circle lies on. Playing with these (and again adding two or more tori together gives some very nice objects. I started with one, so here is a second to finish:

Acknowledgements: Inspiration and most of the best ideas on spirographs come from conversations with Richard Grimes. The 3d renderings are made using Blender and LuxRender. Thanks to Ian Hopkinson (@SmallCasserole) for introducing me to this.

I’m seriously impressed by your renderings! It seems luxrender was just the thing you were looking for…

Thanks! Indeed it was. I had become rather frustrated with POV-Ray but had not found other open source alternatives. I do miss the CSG abilities of POV-Ray though, blender does not seem to do it well at all. Do you know any alternatives?

Not sure about CSG for Blender – have a look for CSG for pbrt (the parent of luxrender) I think there were some people looking at plugins.

When I noticed the top image, I intitally thought that it was stereolithography – so I guess that’s a tick in the box for realism.

Thanks, thats why I have fallen in love with luxrender! I have made some models on a Zcorp machine, unfortunately you have to worry about things like strength for the 1d models!

Now that you mention, I remember my mom did lots of spirograph like drawing, by hand. And I did, too, when I was young, but much less than her.

I like a lot the three circles: when you stare at them, you have the feeling they move :)

Pingback: Weekend miscellany — The Endeavour

Great post, interesting curves and lovely renderings.

I was looking at some related curves in grasshopper recently – videos here:

Absolutely beautiful, the first video is essentially the same. I wish I had had the time and skill!

Apologies, they are not quite the same. I hate trying to think in 3d! Far to easy to make a mistake.

Pingback: Open Laboratory 2010 – submissions so far « A Blog Around The Clock

Pingback: Open Laboratory 2010 – submissions to date « A Blog Around The Clock

Pingback: Open Laboratory 2010 – submissions so far | A Blog Around The Clock

Pingback: Open Lab Update | Child's Play

Pingback: Open Laboratory 2010 – one month left to submit! | A Blog Around The Clock

Pingback: Open Laboratory 2010 – three weeks to go! | A Blog Around The Clock

Pingback: Open Laboratory 2010 – two weeks to go! | A Blog Around The Clock

Pingback: Open Laboratory 2010 – only eight days till the deadline! | A Blog Around The Clock

Pingback: Only three days to go – Open Laboratory final stretch for submissions! | A Blog Around The Clock

Pingback: It’s getting hot – submissions for Open Laboratory 2011 are flying in by the dozens per hour… how about you? | A Blog Around The Clock

Pingback: Open Laboratory 2010 – the final stretch! | A Blog Around The Clock

Pingback: Open Laboratory 2010 – submissions now closed – see all the entries | A Blog Around The Clock

Pingback: I find myself looking for a job… « Maxwell's Demon

Lissajous figures in 3D are possible as well. I’ve plotted several interesting shapes in MATLAB.

Bonjour tout d’abord bravo pour votre site que j’ai parcouru avec plaisir. cet article a retenu tout mon attention car je le trouve bien r�dig� et tres int�ressant. d’habitude je ne commente pas les sites mais aujourd’hui je prends quelques instants pour le faire. Je vous contacterais pour faire un �change de lien avec mon propre site. En esp�rant vous lire bientot.

Pingback: free london dating

I’ve done some 3D roses of the equation r = A + B * cos (C * theta) * cos (D * phi). The pictures are available here http://coderextreme.net/roses/ I like trans9.jpg