Home
Full resolution,

Fractal Art

The inimitable 3Blue1Brown does a far better job illustrating space filling curves than I ever could, take a look [youtube]. Just the first 15 seconds of the video is enough to get a sense of what a space filling curve is: a simple rule applied to a line segment that results in self-similar geometry that fills a 2D space (higher dimensions are possible too).

The pattern presented here is a Moore curve. It is one continuous line that snakes its way all over the space and returns to its starting point. The line slowly changes colour along its length, which creates the appearance of distinct regions when viewed from afar.

Keen-eyed readers may have noticed that this is also this website's icon!

The rules that create this pattern are very simple.

Alphabet: L, R
Constants: F, +, −
Axiom: LFL+F+LFL
Production rules:
L → −RF+LFL+FR−
R → +LF−RFR−FL+
            
Source: wikipedia

These statements produce the instructions necessary to draw out a Moore curve.

If you follow the instructions in the Axiom and choose up as the initial forward direction, this is what would happen (remember: keep each line segment the same length) You should end up with an "n" shape. This is an order 1 Moore curve. To get higher orders (and more interesting shapes) apply the Production rules to the Axiom as many times as desired, and then follow the resulting instructions. The production rules substitute the non-drawing characters L and R with a new set of characters that include drawing instructions as well as more L and R, so the production rules can be applied again and again for more complex outputs. Applying the production rules once yields (parentheses added for clarity):

Order 1:        L      F      L      +F+      L      F      L
Order 2:  (−RF+LFL+FR−)F(−RF+LFL+FR−)+F+(−RF+LFL+FR−)F(−RF+LFL+FR−)
            

The poster above was produced with an order 7 Moore curve, so the above process would be repeated 5 more times.

Technical Notes

This work was produced using Python, numpy and matplotlib were used for generating the curve and plotting. The palette is matplotlib's built-in "twilight" color map.