The Dragon Curve

The Dragon Curve is a classic example of a recursively generated fractal shape. Mandelbrot calls it the "Harter-Heighway" dragon curve and it was the subject of one of Martin Gardner's Mathematical Games columns in Scientific American in 1967.

The algorithm for generating the curve can be succinctly described by an L-system (for Lindenmayer). A short course on L-systems may be found at

L-systems tutorial at Australian National University

The L-system for this curve is

             Angle 8     
             Axiom FX    
             F=          
             Y=+FX--FY+  
             X=-FX++FY-
as found in the FRACTINT program. The "Angle" being 8 means that turns are a multiple of 360/8 = 45 degrees. A + means turn counterclockwise while a - means turn clockwise. An F means draw a line segment of length one unit forward.

The symbols X and Y have no graphic meaning; they are used simply to define the rules for generating the curve. The first generation of the curve is the axiom FX, which means we, after ignoring the X, simply draw a line segment one unit forward. To obtain future generations, we apply the replacement rules for F, X and Y to the previous generation. Note that the F's in the previous generation are all deleted in the next generation.

   Gen. 1:                    FX
   Gen. 2:                 -FX++FY-
   Gen. 3:           --FX++FY-+++FX--FY+-   
   Gen. 4: ---FX++FY-+++FX--FY+-+++-FX++FY---+FX--FY++-         

Thus, on the fourth generation we draw 8 line segments of unit length. As we proceed to the next generation, we assume we scale down the length of the line segments so that the picture has the same size as before.

We now show the pictures of generations 2 through 4.

Generation 2:

Above we see a 45 degree turn clockwise (-) followed by a 90 degree turn (++) counterclockwise. This makes a 90 degree corner shape. We show the previous generation as a dotted blue path.

Generation 3:

Each line segment in the previous generation is replaced by a corner alternately pointing to the left or to the right.

Generation 4:

Finally, we can carry this out to generation 18 and see approximately what the limiting shape is.

The dragon curve fills out an "island" of positive area with a fractal boundary, i.e. the boundary is so oscillatory that its "dimension" is strictly greater than 1 (not a linear object).


The pictures were generated by a PostScript program of just a few lines. For those of you who know PostScript, here is the code:

dragon.ps (use shift-click to download)


wrightd@math.okstate.edu
Last modified: Thu Dec 11 20:39:33 CST 1997