The flowsnake, also known as the 'Peano-Gosper' curve is a rather dashing space-filling curve. There is also a demonstration of it on the space-filling curves page.

The following implementation uses 'mutual recursion' - i.e. two methods that call each other.

The flowsnake has the important property that it tiles the plane. And it does it in a somewhat sexier fashion than the Hilbert curve, which, in turn, is somewhat sexier than the Peano curve.

Here's a definition of a snowflake.

Let's see it in action.

What if we draw a bunch of flowsnakes one after the other? We get a flowsnake chain.

What if we turn a little bit in between each flowsnake?

We get a daisy chain of snowflakes.

How much we turn dictates how many snowflakes we get. They join up neatly.

So if you're making a list from most to least sexy of the three space-filling curves I've covered, it would go Peano-Gosper, Hilbert, Peano.

There's something satisfying about that list: Peano-Gosper, Hilbert, Peano. If you created an L-system where "Peano" -> "Peano-Gosper, Hilbert, Peano", then after a few iterations you'd have:

Peano-Gosper, Hilbert, Peano-Gosper, Hilbert, Peano-Gosper, Hilbert, Peano-Gosper, Hilbert, Peano-Gosper, Hilbert, Peano-Gosper, Hilbert, Peano-Gosper, Hilbert, Peano.

And soon I think you'd find a way to demonstrate that this can be represented as a Sierpinski triangle. Sierpinski triangles are just like that. Always Popping Up When You Least Expect It.

Overlapping Flowsnakes

Something interesting happens when we deliberately overlap a bunch of Flowsnakes.

This is the picture we get when we draw 6 flowsnakes, and turn left 60 degrees instead of turning right 60 degrees.

That central part of that pattern would make for a very nifty and irregular tile motif in the bathroom of a retirement village for mathematics professors.

Or if we combine two 'multi flowsnakes' in a different configuration...

Other combinations are possible.

Now. What if we didn't draw the lines of a flow snake. But instead draw the vertices.

Here's a variation I created, along those lines, that would make a pretty good T-shirt.


Logo + Turtle graphics via Papert.