Dragon Fractal Applet



The source.

Instructions

Basically, you just pick your options, hit the "Draw Fractal" button, and see what happens.

The controls are pretty simple:

I will be adding features when I have the time. There's a bunch of things I'd like to do with this applet including more drawing styles and more control over the colors used. If you have any suggestions, please feel free to send them to me!

About The Dragon Fractal

The dragon is a fractal that first came to my attention when I read Jurassic Park by Michael Crichton. The book was divided into sections called "iterations", each of which featured a drawing of a fractal that grew at each stage. I took it upon myself to figure the fractal out, which took me a few days playing on my computer. The fractal is generated by drawing a line segment and then turning left or right before drawing the next one. The key, of course, is figuring out the sequence of left and right turns.

The first step is to pick a "mirror" turn. I use left in this applet. The first turn in the sequence is the mirror. Then for each iteration:

  1. Put the mirror at the end of the current turn sequence.
  2. Reverse all the turns that came before the new mirror in both order and direction (LLLR becomes LRRR) and put them on the end of the turn sequence.

Here's how it works in practice. We'll use "L" for left turns and "R" for right turns. Red "L"s are the current mirror
L(starting position)
LL(add the mirror)
LLR(reverse and invert all turns before the mirror, first iteration done)
LLRL(add the mirror)
LLRLLRR(reverse and invert all turns before the mirror, second iteration done)
LLRLLRRL(add the mirror)
LLRLLRRLLLRRLRR(reverse and invert all turns before the mirror, third iteration done)
LLRLLRRLLLRRLRRL(add the mirror)
LLRLLRRLLLRRLRRLLLRLLRRRLLRRLRR(reverse and invert all turns before the mirror, fourth iteration done)