# Is there a 3D Gosper curve?

The Gosper curve is one of the most amazing and satisfying plane-filling curves.

The Gosper curve is a self-avoiding, plane-filling fractal curve containing 7^n segments (where n is the order of the teragon). It approximates the shape of a hexagon. It is named after the mathematician William Gosper.

Like all plane-filling curves generated using a deterministic recursive algorithm, the Gosper curve can be mapped to a tiling. In this case, the tile is the hexagon. As you increase the order of the teragon, the number of line segments – and thus hexagons – increases. And the boundary becomes more rugged. Below at right is an image of the Gosper boundary, created by the tiling of seven “rep-tiles“, each self-similar to the whole shape.

Counting Pennies

The regular hexagon is similar to the circle in the sense that the close-packing of circles forms a hexagonal arrangement. Imagine having 343 (7^3) pennies arranged on a table. If you try to push them together into the smallest area you can,  you might end up approximating the shape of the Gosper curve.

There are many ways to count a bunch of pennies. In this case you could count them in the order of the Gosper curve’s sweep. Since it is recursive, you could pause every 7 pennies to catch your breath. And you could also pause every 49 pennies for longer breaks. Between each break, you will have traced out a low-order Gosper curve.

On To the Third Dimension

Now, what if we extend this idea to three dimensions? Well, consider the close-packing of spheres. In the case of spheres, there are 12 spheres that can surround a single sphere, making a clump with a total of 13 spheres.

And…just as close-packing circles correspond to the tiling hexagon, 3D circles (spheres) correspond to the tiling rhombic dodecahedron.

Rhombic dodecahedra can be tiled infinitely, leaving no gaps and having no overlaps. This brings us to the big question: might there be a 3D spacefilling curve that can be drawn within a volume which is the union of 13^n rhombic dodecahedra? In other words…

Is there such a thing as a 3D Gosper Curve?
Now, to be fair…asking this question is a bit like asking, “Is there a 3D Mandelbrot Set?” The boring but true answer is no, of course not! …because the canonical Mandelbrot Set is by definition a 2D object. Also, the mathematical properties of complex numbers do not translate into 3D.

You may be able to find a 4D analog of the Mandelbrot Set by skipping the third dimension and jumping over to the fourth dimension. (Hamilton tried in vain to find a 3D analog of complex numbers. And this led him to the next dimension – where he discovered quaternions). FYI – the Mandebrot Set’s 2D nature didn’t stop explorers from trying to find a higher being. And in the process, what they found was something extraordinary: The Mandelbulb.

Now, back to the 3D Gosper curve. Is there is anything we can call a “3D Gosper curve”? To earn that title, it would have to have some fundamental attributes in common with the Gosper curve. This is what I had in mind as I set out to discover this elusive higher being. As a template, I chose the tessellation of 13 rhombic dodecahedra, because it it similar to the tessellation of 7 hexagons.

I posed my question to mathematician Henry Segerman. Just as you can tile seven hexagons (one in the middle surrounded by six), you can analogously tile thirteen rhombic dodecahedra (one in the middle surrounded by twelve). But can you then take 13 of these shapes and tile them into a larger blob of 13^3 dodecs? To explore the problem, Henry came up with the following images that he created using Rhino. After only two levels of recursion, he came to the conclusion that they probably do not tile   !!!!

I asked Henry to send me the file for this 3D model, and then asked my colleague Barry Stump to fabricate it on his 3D printer. Here’s what Barry came up with:

Well, three of these shapes tessellate. But we need to tessellate 13 of them with the same symmetry as the original 13 unit tiles – to see with our own eyes and feel with our own hands – before we can be sure.

Before even asking whether a space-filling curve can be drawn that traverses each dodecahedron, I needed to determine whether the overall space can recursively tile without limit, and with no gaps or overlaps. If the answer is negative, then there is no use in asking about the curve, because it would not extend infinitely, as in the case of the canonical Gosper curve.

The jury is out. But it’s not looking good. A proof that it cannot be done would be better than nothing.

On Filling Fractal Dimensions

It is well known that the Hilbert curve can be extended into 3D, as was shown in The Algorithmic Beauty of Plants. (My friend Dave Fracchia did the raytrace rendering of this on an old SGI machine – back in the day 🙂 Anyway, there are still many unanswered questions. I have a feeling that certain people (like Henry) will have key insights about this. Henry has created physical versions of the Hilbert curve. This is an example of a 3D space-filling curve that has a direct analog in 2D. So what is it about the Hilbert curve that allows it to extend into 3D?

My original line of inquiry was this: think of the Hilbert curve in terms of tiling squares. The 2D Hilbert curve maps a line of length 2 to a square of area 2^2 = 4. The 3D Hilbert curve maps a line of length 2 to a cube of volume 2^3 = 8. The idea of the Hilbert curve as progressive squaring is described in my blog post comparing the Hilbert curve with the Peano Sweep:

Could the same logic be used with other shapes? Other than the cube, the logical 3D tessellating shape in my mind is the rhombic dodecahedron. But it appears not to tesselate recursively to create rep-tiles. My hope was (and still is) that there exists a tiling polyhedron within which one can fit a line between vertices having a length equal to the cube root of 13, and that 13 of these would tile to form a volume of 13. But am I misguided by looking for the cube root? Perhaps I need to consider the square root? (The Euclidean distance).

Here’s a picture I drew of 13 unit cubes representing rhombic dodecahedra. (BTW – if you stellate each face of a cube by adding a square pyramid, it becomes a rhombic dodecahedron. And if you start with a “3D checkerboard” of 13 cubes, like I have drawn, the result is 13 tessellating rhombic dodecahedra. Cool, eh? Now, look at red lines in the drawing. the distance from A to B happens to be the square root of 13 (assuming unit cubes).

A line drawn from A to B might be analogous to the line drawn within the hexagon in the image at the beginning of this article. Am I missing something?

I have a feeling that there are answers right around the corner. And it may be that I am simply asking the wrong questions!

And it still may be that we have to jump over the third dimension to the land of quaternions to get the right answers. There, we might find a new realm of hyper-space-filling curves – living among the integer quaternions – analogous to the Gaussian and Eisenstein integers, which are integral domains in which number theory can be used to make sense of space-filling curves.

# The Hilbert Curve is Similar to the Peano Sweep

Imagine an upward surge of fluid like this:

As the dark fluid surges upward, the light-colored fluid around it gets pulled inward, creating a “neck” as shown above at right, and the dark fluid bifurcates at the top. You can compare this shape to the generators for the Hilbert curve and the Peano Sweep. Since these are plane-filling fractal curves, they carry this dance of surging fluids down to smaller and smaller levels, until the fluid regimes are completely mixed. Below are the first few iterations of this mixing.

Hilbert Curve

Peano Sweep

The Hilbert curve is conveniently self-avoiding: no matter how much the fluids mix, the curve never touches itself. But the Peano Sweep has overlapping segments. This can be alleviated using a technique to separate the overlaps, which makes it topologically similar to the Hilbert curve, in terms of its intricate branching structure.

This comparison is described in more detail here, and it is illustrated below.

One key difference is that the Hilbert curve is a “node replacement curve” while the Peano Sweep is an “edge-replacement curve”. Edge-replacement curves were used by Mandelbrot in the introduction to fractals in his book. (He referred to this as Koch construction).

The Hilbert curve and Peano Sweep both conform to a four-square tiling scheme in which the main square is replaced with four smaller squares, and the two bottom ones are rotated inward.

Notice that the Hilbert curve requires connective links at every iteration. This is a required step for node-replacement curves, as shown in this variation of Mandelbrot’s Quartet that I discovered:

There are many more examples of plane-filling curves that use different tiling schemes, including a series of curves that Peano discovered, using nine inner-squares.

Several people have used plane-filling curves like this to define an image as a squiggly line. Imagine drawing the Mona Lisa with only one line, and the line gets more squiggly when it needs to cover a darker area:

(the above image is based on the Peano Sweep and it is explained here)

Stay tuned for more adventures with plane-filling curves!

-Jeffrey

# Fractal Curves in Gaussian and Eisenstien Integer Lattices

I have been working on a taxonomy of space-filling curves in the square and triangular lattices. I came across Adam Goucher’s blog: Complex Projective 4-Space. I asked Adam what he thought of my proposed fractal curve families and he told me that I should study the Gaussian and Eisenstein integers. The image below shows Gaussian integers (red dots) and Eisenstein integers (blue dots).

So cool! Adam pointed me to a whole new world of discovery that I am still unraveling and unfolding to this day.

I will not get into the details of Gaussian and Eisenstein integers here, except to say that they are sets of complex numbers occupying square and triangular lattices respectively. (You can click on the links provided and follow the search to any level of detail you wish).

They can be seen as two-dimensional versions of the one-dimensional number line of integers that we are all so familiar with.

Like their familiar one-dimensional counterpart, the Gaussian and Eisenstein integers form an integral domain: the rules of addition and multiplication apply, and these operations always result in a new number which is within the domain. Gaussian and Eisenstein integers have their own unique prime number and composite number personalities – which make for a fascinating study – including how they relate to families of plane-filling curves.

The Koch Curve and it’s Squarish cousin occupy triangular and square grids, respectively. And each has a “spine” that traverses exactly three units.

In these two lattices, all distances of grid points from the origin (0+0i) are square roots of integers (Euclidian norm).

Squaring the Euclidian norm gives us the field norm , the integer that we use to denote the fractal family. It is either prime or composite.

Here are some examples of plane-filling curves that occupy the square lattice:

Example 1 (also discovered by Carbajo)

Example 2 (Mandelbrot’s “Quartet”)

Example 3: (a Root 13 self-avoiding curve)

And here are some examples of plane-filling curves that occur in the triangular lattice:

Example 4: (a curve I discovered)

Example 5: (a member of the Root 7 family)

Example 6: (a member of the triangle Root 9 family)

Check out the generators of these curves (shown at the left of each diagram). You may have noticed that some of them consist of line segments of differing lengths. These represent members of composite fractal families: their spines traverse a distance that is equal to the square root of a composite number in the domain. (Examples 1, 4, and 6 are composite).

The members of “prime” families (examples 2, 3, and 5 above) can only have segments of length 1. Consequently, as they are iterated to create higher-level teragons, with more fractal detail, the texture becomes more even and smooth. The composite curves – on the other hand – have varying density within their flesh, which increases in variety as they are iterated.

This is awesome: it’s another way to show the recursive complexity of composite numbers. And if you ask me (and Greg Chaitin), the composite numbers are way more interesting than the primes!

Here’s a plane-filling curve of the root-8 family. Since 8 = 2^3, this family contains interesting variants of the famous dragon curve, which is a member of the root 2 family. This example has the corners rounded for aesthetics. It shows some of the variation in scale within its flesh.

I’ll be posting more as discoveries are made. Stay tuned!

-Jeffrey

# Space-Filling Curves Are Not Squares

Wikipedia says:

“In mathematical analysis, a space-filling curve is a curve whose range contains the entire 2-dimensional unit square (or more generally an n-dimensional hypercube“.

The image at right shows the Hilbert curve as an example. Indeed, the Hilbert curve fills a square. And its 3D counterpart fills a cube.

However, a space-filling curve (or…to just stick with two dimensions: a plane-filling curve) can be more generally described as a curve that fills a region of the plane that is topologically equivalent to a square (or…a disk). Note that a filled-in square, a disk, and a cone are topologically the same. “A cone?” you may ask. Yes, it has one surface (interior), and one boundary.

Now consider the following space-filling curves:

Here we see the famous Dragon Curve, the Gosper Curve, and two curves that I discovered. If you have spent any time studying the Dragon curve, you know that it can be decomposed into a series of “body parts” joined at wasp-waist points. How many body parts? Why, infinitely many, to be exact. Topologically-speaking, this would be the same as an infinite chain of tangent disks.

Next is the Gosper Curve. it is topologically equivalent to a disk. Mandelbrot compared its boundary to the shape of France. Appropriate for a discussion on fractals, since the boundary of France is almost entirely determined by coastlines and mountain drainage divides.

And what about the last two curves? My first guess was that the third one from left, the “Dragon of Eve“, is topologically equivalent to a disk….however, there are regions of the boundary which get closer and closer, every time the curve is iterated. My conjecture is that the curve approaches a state of self-contact at the limit. That puts it in a different topological category than a mere disk, since the boundary is self-touching at infinitely many points.

The last curve is one I call “Brain-Filler“.

This curve resolves to a region of the plane that is topologically equivalent to a disk. Ignore the lines that extend upward and downward; they are thickened for aesthetic reasons. And besides, when iterated to the limit, the infinitely thin nature of a fractal curve gives way to the finite shape that it fills.

But!

…you may have noticed the way the curve wiggles its way through the shape. It is not evenly-filled, as in the case of the Gosper curve. So, the question comes up: does it really “fill” the space if it is not filling it evenly?

We could ask the same of Mandelbrot’s famous Snowflake Sweep.

Think through this with me: as the curve is iterated repeatedly, replacing each segment with a smaller, transformed version of itself, the interior of the snowflake curve become ever more filled-in. But…the density. varies.

At the limit, I conjecture that the interior will be filled-in with varying degrees of infinite density. And I am talking about different kinds of infinity in the Cantorian sense.

The Fractal Boundaries of Fractal Curves

So…there are space-filling curves that fill planar regions with fractal boundaries – boundaries that are more interesting and varied than boring old squares; boundaries that come around and touch themselves, or even penetrate themselves in ways that dizzy the mind.

Space-filling curves are like symphonies – beautiful on all scales.

There may be a valid reason why the authors of the Wikipedia page cited above did not include any non-square space-filling curves. But I cannot think of a good reason – other than the fact that the Hilbert Curve provides a clear, easy-to-understand, easy-to-visualize example. However, a good example should not justify an incomplete definition.

Mandelbrot spent his career trying to get geometers away from squares and circles, and to appreciate, understand, and describe the fractal geometry of nature. His amazing book still stands as the best original source for fractal geometry, in my opinion.