Kite curve
The dragon curve is a fractal object that is created by substitution, similar to the Koch curve and Hilbert curve .
construction
An illustrative method of creating the kite curve is as follows:
- Take a strip of paper and fold it in half so that its length is halved.
- Repeat this as often as you like, making sure that you fold in the same direction each time.
- Finally, unfold the paper and arrange it so that the inner angles of the folds are always 90 °.
algorithm
Further implementations in the Rosetta Code Wiki.
Lindenmayer system
The kite curve can be described by a Lindenmayer system with the following properties:
- Angle: 90 °
- Terminals
- variables
- Start string:
- Derivation rules:
F here means a new route along the "line of sight". Plus and minus correspond to a 90 degree rotation clockwise or counterclockwise.
Pseudocode
To simplify the representation of a kite curve, a coding with the symbols R and L is used below. The kite curve is drawn in a similar way to Turtle graphics : R means a 90 ° turn to the right and L means a 90 ° turn to the left. You start with a line upwards. Then a line is drawn in the current direction after each symbol. So there is one more line than symbols in every kite curve. Using this coding, a kite curve can be constructed algorithmically as follows:
- The kite curve 0th order consists only of the starting line "upwards".
- The 1st order kite curve is R (start line, then right turn and another line)
- Calculate a kite curve of order i + 1 as follows:
- Add an R to a kite curve of order i
- Overhangs at the result again the dragon curve of order i, wherein the average character by L is replaced.
As an example the coding of the kite curves of the order 0 to 5. The inserted R is printed in bold below, the middle character replaced by L in italics.
0. Ordnung: ε (leerer String) 1. Ordnung: R 2. Ordnung: RRL 3. Ordnung: RRLRRLL 4. Ordnung: RRLRRLLRRRLLRLL 5. Ordnung: RRLRRLLRRRLLRLLRRRLRRLLLRRLLRLL
Dragon curves of various orders
An n-th order kite curve consists of segments. The following are the first 16 kite curves: