Sierpiński curve


Sierpiński curves are a recursively defined sequence of continuous closed plane fractal curves discovered by Wacław Sierpiński, which in the limit completely fill the unit square: thus their limit curve, also called the Sierpiński curve, is an example of a space-filling curve.
Because the Sierpiński curve is space-filling, its Hausdorff dimension is.

The Euclidean length of the th iteration curve is
i.e., it grows exponentially with beyond any limit, whereas the limit for of the area enclosed by is that of the square.

Uses of the curve

The Sierpiński curve is useful in several practical applications because it is more symmetrical than other commonly studied space-filling curves. For example, it has been used as a basis for the rapid construction of an approximate solution to the Travelling Salesman Problem : The heuristic is simply to visit the points in the same sequence as they appear on the Sierpiński curve. To do this requires two steps: First compute an inverse image of each point to be visited; then sort the values. This idea has been used to build routing systems for commercial vehicles based only on Rolodex card files.
A space-filling curve is a continuous map of the unit interval onto a unit square and so a inverse maps the unit square to the unit interval. One way of constructing a pseudo-inverse is as follows. Let the lower-left corner of the unit square correspond to 0.0. Then the upper-left corner must correspond to 0.25, the upper-right corner to 0.50, and the lower-right corner to 0.75. The inverse map of interior points are computed by taking advantage of the recursive structure of the curve. Here is a function coded in Java that will compute the relative position of any point on the Sierpiński curve. It takes as input the coordinates of the point to be inverted, and the corners of an enclosing right isosceles triangle,, and. The remaining parameters specify the level of accuracy to which the inverse should be computed.

static long sierp_pt2code

Representation as Lindenmayer system

The Sierpiński curve can be expressed by a rewrite system.
Here, both F and G mean “draw forward”, + means “turn left 45°”, and means “turn right 45°”. The curve is usually drawn with different lengths for F and G.
The Sierpiński square curve can be similarly expressed:

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: and. A and B recur and at the bottom do the same thing — draw a line. Plus and minus 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 then you end up turned 60 degrees, at a different point in the triangle.

Code

Given the drawing functions void draw_line; and void turn;, the code to draw an Sierpiński arrowhead curve looks like this:

void sierpinski_arrowhead_curve


void curve

Representation as Lindenmayer system

The Sierpiński arrowhead curve can be expressed by a rewrite system.
Here, F means “draw forward”, + means “turn left 60°”, and means “turn right 60°”.