L-System plants

This page describes two programs (really one), which recursively draw lsystem plants.

The procedure is as follows:

For example, using the first program, the following parameters are entered:
One branch, three orders,
Branch one: -30 degrees, 0.5 times as long as the parent, and branching 0.5 of the way along the parent
This produces the following image:
Note how there are 3 branches (and a red trunk). This corresponds to the 3 orders. The brownish branch is drawn 0.5 of the way along the trunk, and is 0.5 times as long. It emerges at -30 degrees (11 o' clock position).
Next consider the following:
Two branches, three orders
Branch one:-30 degrees, 0.5 length, 0.5 ratio
Branch two:50 degrees, 0.5 length, 0.5 ratio
Notice now how there are two branches leaving the trunk, and two more leaving each of those, and two more leaving each of those (14 in total).
Using the 'random stuff' feature causes the computer to randomly pick the angle, length, and ratio for each branch. (instead of typing it in). The seed allows you to recreate the same random tree again.

Warning: Total number of twigs drawn increases exponentially with the number of orders - for 3 branches and 4 orders there are 120 twigs, for 3 branches and 5 orders there are 363. So using several branches can quickly cause an unacceptable drawing time. Anyway, it just ends up producing a messy spiky bush anyway!

The second program just varies the three parameters using sine waves (frequencies determined randomly with a seed), and uses the keys to smoothly vary the parameters (either slowly or quickly). This quickly allows creation of realistic bushes, simply by cycling through many similar sets of parameters.
The screenshots show some examples. Best results are obtained just be messing around.
Qbasic l-system plants program
Qbasic l-system animated plants program

Screen shots (Parameters as shown)

Hosted by www.Geocities.ws

1