Sierpiński curve

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 n ightarrow infty 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 (in the limit n ightarrow infty ) is 2 .
The Euclidean length of S_n is l_n = {2 over 3} (1+sqrt 2) 2^n - {1 over 3} (2-sqrt 2) {1 over 2^n} , i.e., it grows "exponentially" with n beyond any limit, whereas the limit for n ightarrow infty of the area enclosed by S_n is 5/12 that of the square (in Euclidean metric).

Uses of 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 Traveling Salesman Problem (which asks for the shortest sequence of a given set of points): The heuristic is simply to visit the points in the same sequence as they appear on the Sierpiński curveref|Platzman89. 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 filesref|BartholdiURL.

A space-filling curve is a continuous map of the unit interval onto a unit square and so a (pseudo) inverse maps the unit square to the unit interval. One way of constructing a pseudo-inverse is as follows. Let the lower-left corner (0, 0) of the unit square correspond to 0.0 (and 1.0). Then the upper-left corner (0, 1) must correspond to 0.25, the upper-right corner (1, 1) to 0.50, and the lower-right corner (1, 0) 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 (that is, a pseudo-inverse value). It takes as input the coordinates of the point (x,y) to be inverted, and the corners of an enclosing right isosceles triangle (ax, ay), (bx, by), and (cx, cy). (Note that the unit square is the union of two such triangles.) The remaining parameters specify the level of accuracy to which the inverse should be computed.

static long sierp_pt2code( double ax, double ay, double bx, double by, double cx, double cy, int currentLevel, int maxLevels, long code, double x, double y ) { if (currentLevel <= maxLevel) { currentLevel++; if ((sqr(x-ax) + sqr(y-ay)) < (sqr(x-cx) + sqr(y-cy))) { code = sierp_pt2code( ax, ay, (ax+cx)/2.0, (ay+cy)/2.0, bx, by, currentLevel, maxLevel, 2 * code + 0, x, y ); } else { code = sierp_pt2code( bx, by, (ax+cx)/2.0, (ay+cy)/2.0, cx, cy, currentLevel, maxLevel, 2 * code + 1, x, y ); } } return code; }

Drawing the curve

The following Java applet draws a Sierpiński curve by means of four methods that recursively call one another:
import java.awt.*; import java.applet.*; public class SierpinskiCurve extends Applet { private SimpleGraphics sg=null; private int dist0 = 128, dist; public void init() { sg = new SimpleGraphics(getGraphics()); dist0 = 128; resize ( 4*dist0, 4*dist0 ); } public void paint(Graphics g) { int level = 3; dist = dist0; for (int i=level; i > 0; i--) dist /= 2; sg.goToXY(2*dist, dist); sierpA(level); // start recursion sg.lineRel(+dist, +dist); sierpB(level); // start recursion sg.lineRel(-dist, +dist); sierpC(level); // start recursion sg.lineRel(-dist, -dist); sierpD(level); // start recursion sg.lineRel(+dist, -dist); } private void sierpA (int level) { if (level > 0) { sierpA(level-1); sg.lineRel(+dist, +dist); sierpB(level-1); sg.lineRel(+2*dist, 0); sierpD(level-1); sg.lineRel(+dist, -dist); sierpA(level-1); } } private void sierpB (int level) { if (level > 0) { sierpB(level-1); sg.lineRel(-dist, +dist); sierpC(level-1); sg.lineRel(0, +2*dist); sierpA(level-1); sg.lineRel(+dist, +dist); sierpB(level-1); } } private void sierpC (int level) { if (level > 0) { sierpC(level-1); sg.lineRel(-dist, -dist); sierpD(level-1); sg.lineRel(-2*dist, 0); sierpB(level-1); sg.lineRel(-dist, +dist); sierpC(level-1); } } private void sierpD (int level) { if (level > 0) { sierpD(level-1); sg.lineRel(+dist, -dist); sierpA(level-1); sg.lineRel(0, -2*dist); sierpC(level-1); sg.lineRel(-dist, -dist); sierpD(level-1); } } } class SimpleGraphics { private Graphics g = null; private int x = 0, y = 0; public SimpleGraphics(Graphics g) { this.g = g; } public void goToXY(int x, int y) { this.x = x; this.y = y; } public void lineRel(int deltaX, int deltaY) { g.drawLine ( x, y, x+deltaX, y+deltaY ); x += deltaX; y += deltaY; } }

The following Logo program draws a Sierpiński curve by means of recursion.

to half.sierpinski :size :level if :level = 0 [forward :size stop] half.sierpinski :size :level - 1 left 45 forward :size * sqrt 2 left 45 half.sierpinski :size :level - 1 right 90 forward :size right 90 half.sierpinski :size :level - 1 left 45 forward :size * sqrt 2 left 45 half.sierpinski :size :level - 1 end

to sierpinski :size :level repeat 2 [ half.sierpinski :size :level right 90 forward :size right 90 half.sierpinski :size :level right 90 forward :size right 90 ] end

References

#Platzman, Loren K. and John J. Bartholdi, III (1989). "Spacefilling curves and the planar traveling salesman problem", Journal of the Association of Computing Machinery 36(4):719&ndash;737.
#Bartholdi, John J. III, [http://www.isye.gatech.edu/~jjb/mow/mow.html Some combinatorial applications of spacefilling curves]

ee also

* Hilbert curve
* Koch snowflake
* Moore curve
* Peano curve
* Sierpiński arrowhead curve
* List of fractals by Hausdorff dimension
* Recursion (computer science)


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • 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. Representation as Lindenmayer systemThe Sierpiński arrowhead curve can be expressed by a rewrite system (L system).… …   Wikipedia

  • Sierpiński carpet — The Sierpinski carpet is a plane fractal first described by Wacław Sierpiński in 1916. The carpet is a generalization of the Cantor set to two dimensions (another is Cantor dust). Sierpiński demonstrated that this fractal is a universal curve, in …   Wikipedia

  • Sierpiński triangle — The Sierpiński triangle, also called the Sierpiński gasket or the Sierpiński Sieve, is a fractal named after Wacław Sierpiński who described it in 1915. [. W. Sierpiński, Sur une courbe dont tout point est un point de ramification ,C. R. Acad.… …   Wikipedia

  • Wacław Sierpiński — Wacław Franciszek Sierpiński (March 14 1882 October 21 1969) (pronounced|ˈvaʦwaf fraɲˈʨiʂɛk ɕɛrˈpʲiɲskʲi), a Polish mathematician, was born and died in Warsaw. He was known for outstanding contributions to set theory (research on the axiom of… …   Wikipedia

  • Wacław Sierpiński — Wacław Franciszek Sierpiński (Varsovie, 14 mars 1882 Varsovie, 21 octobre 1969) est un mathématicien polonais, connu pour ses contributions à la théorie des ensembles, la théorie des nombres, la théorie des fonctions et la topologie …   Wikipédia en Français

  • Space-filling curve — 3 iterations of a Peano curve construction, whose limit is a space filling curve. 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) …   Wikipedia

  • Hilbert curve — A Hilbert curve (also known as a Hilbert space filling curve) is a continuous fractal space filling curve first described by the German mathematician David Hilbert in 1891. [D. Hilbert: Über die stetige Abbildung einer Linie auf ein Flächenstück …   Wikipedia

  • Moore curve — A Moore curve (after E. H. Moore) is a continuous fractal space filling curve which is a variant of the Hilbert curve. Precisely, it is the loop version of the Hilbert curve, and it may be thought as the union of four copies of the Hilbert curves …   Wikipedia

  • De Rham curve — In mathematics, a de Rham curve is a certain type of fractal curve named in honor of Georges de Rham. The Cantor function, Césaro curve, Minkowski s question mark function, the Lévy C curve, the blancmange curve and the Koch curve are all special …   Wikipedia

  • Liste de fractales par dimension de Hausdorff — Cet article est une liste de fractales, ordonnées par dimension de Hausdorff croissante. En mathématiques, une fractale est un ensemble dont la dimension de Hausdorff (notée δ) est strictement supérieure à la dimension topologique[1]. Sommaire 1… …   Wikipédia en Français

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”