Recently I completed a small project related to the Hilbert curve. So I have been a bit interested in space filling curves since then. Hence I decided to create implementations of three of the more famous ones out there, that is the Sierpinski curve, the Sierpinski arrowhead curve, and the Gosper curve.
I am really hoping that these recent fractal projects (including those on the Hilbert curve, bifurcation diagrams, the chaos game, along with this one) have gotten the fractal out of my system at least for a little while. However, I am sure I will eventually return back to the fractal world. At least my current fractal addiction isn’t as bad as my old font collecting addiction.
Sierpinski Arrowhead Curve
While writing code for the Hilbert curve I came across a few references to the Sierpinski arrowhead curve. Basically, the previous code for the Hilbert curve can be modified a bit to produce this new fractal. The code isn’t that great but was ok enough to produce some results; the main thing about the so-so code was motivation to learn of a new way to draw such curves in the future.
Below are implementations of the Sierpinski arrowhead curve after 8 iterations on the left, and the first 6 iterations on the right.
There are more than a few different instances of the Sierpinski arrowhead curve out there. These ones amused me a bit:
- Someone made some cool jewellery out of copper wire
- There are some 3D versions out there… like these [1], [2], and [3]
- Also there is a web based tool to create these curves
Sierpinski Curve
So while making the previous curve, I realized that there is a more efficient way to code these things. Hence, I made the jump to creating fractals with L-systems. To be honest I was always a little confused with them at first and would just skip over when I saw them mentioned, but after a moment writing some code they actually fun to deal with.
So the Sierpinski curve can be implemented using the following L-system:
Bellow are implementations of the Sierpinski curve after 7 iterations on the left, and the first 6 iterations on the right.
Some related links…
- A list of other L-system based fractals
- Cool implementation in the form of a neckless
- And the web version from Online Math Tools
Gosper Curve
Getting into L-system based fractals, I was rather amused by the Gosper curve (or Gosper-Peano Curve). It is also called the flowsnake by some people out there.
The L-system for the Gosper curve is:
Below are implementations of the Gosper curve, with the results after 5 iterations on the left and the first 4 iterations on the right.
Some interesting links that I stumbled over:
- This is a cool laser cut wood implementation
- This paper cut version is pretty ridiculous
- Someone made a plot on a whiteboard using a polar plotter
- A paper on some other variations of the Gosper curve
- And finally an ‘impossible’ 3d version
No Comments