#### Dragon Curve

The Dragon curve is a two-dimensional fractal, also known as Jurassic Park dragon.

It can easily be created with a piece of paper:

It can easily be created with a piece of paper:

- Fold it \(n\)-times in
**the same**direction. - Unfold the paper. Every fold is either a hill or a valley.
- Twist every fold to make it a \(90^\circ\) corner. If it´s a hill, twist it to the right, if it´s a valley, twist it to the left.

###### Formula

The formula for this calculation looks like this:

\(A=\{\text{"L"},\text{"R"}\}, w\in A\)

\(w_1=\text{"R"}\)

\(w_{n+1}=w_n\left[1:|w_n|\right]\cdot \text{"R"}\cdot w_n\left[1:\frac{|w_n|}{2}\right]\cdot \text{"L"}\cdot w_n\left[1+\frac{|w_n|}{2}:|w_n|\right]\)

\(w\) resembles a word, \(w[i:j]\) is a substring of \(w\) with chars from position \(i\) to position \(j\).

You can see that the function recursively determines the folding directions.

The calculated word is then translated into a line with one corner for each char of the word. The line makes a left turn when a char is equal to \(\text{"L"}\) and a right turn when it´s equal to \(\text{"R"}\). The outcome is visualized below.

\(A=\{\text{"L"},\text{"R"}\}, w\in A\)

\(w_1=\text{"R"}\)

\(w_{n+1}=w_n\left[1:|w_n|\right]\cdot \text{"R"}\cdot w_n\left[1:\frac{|w_n|}{2}\right]\cdot \text{"L"}\cdot w_n\left[1+\frac{|w_n|}{2}:|w_n|\right]\)

\(w\) resembles a word, \(w[i:j]\) is a substring of \(w\) with chars from position \(i\) to position \(j\).

You can see that the function recursively determines the folding directions.

The calculated word is then translated into a line with one corner for each char of the word. The line makes a left turn when a char is equal to \(\text{"L"}\) and a right turn when it´s equal to \(\text{"R"}\). The outcome is visualized below.

Huge Version

*settings_overscan*