Fractal figures generated using L-systems
an applet made by António Miguel de Campos (Portugal)

What you see at start is a "show" with the first iterations of some algorithms that generate fractal figures using L-systems, i.e. they are based in formal grammars. The "show" can be interrupted clicking in the button in the right, that initially has a E (for Escape), and can be restarted pressing the same button when it has a S (for Show). After the "show" finishes, or after you command it to do so by clicking in E, click in the Iterate button a few times to see a plant "in development".

Each time that a new line is drawn, it has a direction that makes a positive or negative angle with the previous one, with a random value chosen inside a certain range. For example, if the selected angle (shown in ang) is + 45º, the value of the angle will be either between (0º and + 45º) and (0º and - 45º). If you click a few times in the + button, you can see the same figure drawn using different random angle values. If you click in the deterministic button, the value of the angle will exactly be + or - 45º. The angle used can be modified in the field to the right of ang, where the initial value is "45" , for the initial Plant 1f program. Write a new number in the field and press Enter. The blank button to the right of the + button allows you to see the drawing using only one color. Click it again to return to the color mode.

When a curve of level 0 is shown, if you click in the chain button, you see the initial chain of commands. As you click in the button Iterate, the chain of commands to draw the plant in each iteration is shown. (The button will read normal; if you click again, it will read chain again and the program will leave the chain of commands mode).

Using the selector to the right, you can select other interesting programs.
Select one program and then start clicking in the Iterate button

Detailed explanation of how the Plant 1f curve is drawn


Using the selector in the right, you can select the other programs. The respective rules and initial chains are the following ones:

Program

Initial Chain

Rules

Angle

Plant 1

0

0 -» 1 [+0] 1 [-0] 0
1-» 11
[-» [
]-» ]
 

Plant 2

0

0 -» 1-[[0]+0]+1[+10]-0
1-» 11

 

Plant 3

0

0 -» 1[+0]1[-0]+0
1-» 11

 

Plant 4

0

0 -» 1[+0][1-0]

 

Plant 5

1

1 -» 1[+1]1[-1]1  

Plant 6

0

0 -» 1[+0][-0]10

 

Plant 7

1

1 -» 1[-11]1[+11]1

 

Plant 8

1

1 -» 11+[+1-1-1]-[-1+1+1]

22.5º

Plant 9

1

1 -» 1[+1[+1][-1]1] [-1[+1][-1]1] 1 [+1][-1]

 

Cristal

[1]+[1]+[1]+[1]+[1]+[1]

1 -» 111[1][+[1]+1][-[1]-1]

60º

Hilbert Curve

7

6-» -71+616+17-
7-» +61-717-16+

90º

Koch Curve

1++1++1

1 -»1-1++1-1

60º

Koch Island

1+1+1+1

1 -»1-11+11+1+1-1-11+1+1-1-11-11+1

90º

Koch Island1

1+1+1+1

1 -»1+1-1-11+1+1-1

90º

Stair Curve

1+1+1+1

1 -»1+1-1-1+1

90º

Stair Curve1

1+1+1+1

1 -»1-1+1+1-1

90º

Koch Curve1

1+1+1+1

1 -»11+1+1+1+11

90º

Koch Curve2

1+1+1+1

1 -»1+11++1+1

90º

Koch Curve3

1+1+1+1

1 -»11+1++1+1

90º

Koch Curve4

1+1+1+1

1 -»11+1+1+1+1+1-1

90º

Hexagonal Curve

a

a-» a+b++b-a--a-b+
b-» -a+bb++b+a--a-b

60º

Peano Curve

6

6-» 61716+1+71617-1-61716-
7-» 71617-1-61716+1+71617

90º

Cross Curve

1+61+1+61

6-»61-1+1-61+1+61-1+1-6

90º

Sierpinsky Curve

a

a-» b-a-b
b-» a+b+a

60º
(*)

Snake Curve

+6++6

6-»616++616

45º

Campos Curve

+6++6

6-»616++616
1 -»11

45º

Dragon Curve

16

6-» 6+71+
7-» -16-7

90º

Spiral Curve

6666

6-»7+7+7+7+7+7+
7-»(1+1+1+1(---7-8)+++++1+++++
+++1-1-1-1)
8-»(1+1+1+1(---8)+++++1+++++++
+1-1-1-1)

15º

Pentagonal Curve
(Penrose tiling)

[7]++[7]++[7]++[7]++[7]

6 -» 81++91----71[-81----61]++
7 -» +81--91[---61--71]+
8 -» -61++71[+++81++91]-
9 -» --81++++61[+91++++71]--71
1 -» .... (1's are eliminated in each iteration)

36º

Cantor Set

1

1-»1x1
x-»xxx

 
(*) in this in case, the angle changes sign in each iteration so that the base of the triangles are always in the bottom.

Notice that commands 6 , 7 , 8 and 9 do not correspond to any specific action and are only used to make the curves evolve as desired; command x corresponds to a step ahead without drawing and the commands a and b both execute a drawing step ahead. The programs whose name finishes in f are versions of the programs with the same name without f, where command 0 inserts a "flower".

Try to modify the values of the angles and to use the "random" option in the programs that by default are in "deterministic" mode.

Fractal mountain

Lorenz atractor - the butterfly effect in a strange atractor  

Mandelbrot set and Julia sets

Wall paper-errors due to finite precision