Sierpiński arrowhead curve
The Sierpiński arrowhead curve is a fractal curve similar in appearance and identical in limit to the Sierpiński triangle.
The Sierpiński arrowhead curve draws an equilateral triangle with triangular holes at equal intervals. It can be described with two substituting production rules: (A → B-A-B) and (B → A+B+A). A and B recur and at the bottom do the same thing — draw a line. Plus and minus (+ and -) mean turn 60 degrees either left or right. The terminating point of the Sierpiński arrowhead curve is always the same provided you recur an even number of times and you halve the length of the line at each recursion. If you recur to an odd depth (order is odd) then you end up turned 60 degrees, at a different point in the triangle.
In code, given these drawing functions: void draw_line( double distance); void turn( int angle_in_degrees); The code to draw an (approximate) Sierpiński arrowhead curve looks like this.
void sierpinski_arrowhead_curve( unsigned order, double length)
{
// If order is even we can just draw the curve.
if ( 0 == (order & 1) ) {
curve( order, length, +60);
}
else /* order is odd */ {
turn( +60);
curve( order, length, -60);
}
}
void curve( unsigned order, double length, int angle)
{
if ( 0 == order ) {
draw_line( length);
} else {
curve( order - 1, length / 2, - angle);
turn( + angle);
curve( order - 1, length / 2, + angle);
turn( + angle);
curve( order - 1, length / 2, - angle);
}
}
Representation as Lindenmayer system
The Sierpiński arrowhead curve can be expressed by a rewrite system (L-system).
- Alphabet: X, Y
- Constants: F, +, −
- Axiom: XF
- Production rules:
- X → YF + XF + Y
- Y → XF − YF − X
Here, F means “draw forward”, + means “turn left 60°”, and − means “turn right 60°” (see turtle graphics).
Like many two-dimensional fractal curves, the Sierpiński arrowhead curve can be extended to three dimensions:
References
Literature
- Peitgen et al., Chaos and Fractals, Springer-Verlag, 1992.
- Roger T. Stevens, Fractal Programming in C, M&T Books, 1989.