Fractint L-System Plants

A tutorial by William McWorter
mcworter@midohio.net
version 1.4
January 1997

Back to Tutorial Index




PLANTS


If you look at a tree, it is not too hard to imagine that a branch of the tree looks very much like a smaller version of the whole tree. The L-system below uses this idea to model a (tumble?)weed.

Weed {
  Angle 50
  Axiom +++++++++++++x
  x=f[@.5+++++++++x]-f[@.4-----------!x]@.6x
  }

The symbols "+", "-", "f", "@", "[", "]", and "!" are reserved symbols in FRACTINT L-Systems. The symbol "x", on the other hand, has no graphic meaning for the FRACTINT L-System interpreter. "x" is just a cell that subdivides into the cells according to the string that follows "x=".

The symbol "+" means "turn left 7.2=360/50 degrees". The symbol "-" means "turn right 7.2 degrees". The text line "Angle 50" tells FRACTINT how much a turn is, namely 360/50 degrees. The symbol "f" means "draw a line in the current direction". The symbols "[" and "]" work together. "[" means "remember the current graphics state, position, orientation, line length, etc." "]" means "set the graphics state back to the remembered state". The symbol "@" means "multiply the current line length by the amount following". Hence "@.5" means multiply the current line length by .5. The symbol "!" means "reverse the meaning of + and-". Now let's translate this L-system into English.

The symbol "x" represents the weed. The Axiom line tells FRACTINT to turn the weed left 13*7.2=93.6 degrees. Since FRACTINT always begins oriented East, this command puts the weed just about upright.

The replacement string for the weed x says draw a line (f), the stem of the weed. Next, shrink the weed by .5, turn left 9*7.2=64.8 degrees, draw the shrunken weed, and return to the stem ([@.5+++++++++x]). This draws the lowest branch of the weed. Next, turn right slightly (7.2 degrees) and draw another portion of the stem (-f). Continuing, shrink the weed by .4, turn right 11*7.2=79.2 degrees, reverse the meaning of right and left, draw the shrunken weed, and return to the stem ([@.4-----------!x]). Finally, draw the weed at .6 size (@.6x). Here is how the Weed L-system looks.

(drawing of Weed using the displayed script)

The L-system files fractint.l and plants.l have many L-systems representing plants. Here are two.


Plant04 { ; Adrian Mariano, from the Algorithmic Beauty of Plants
	; Plant-like structure, figure 1.24d p.25
	angle 18
	axiom x
	X=F[+X]F[-X]+X
	F=FF
	}

(drawing of plant4)

Bush { ; Adrian Mariano
  Angle 16
  Axiom ++++F
  F=FF-[-F+F+F]+[+F-F-F]
  }

(drawing of Bush)

Besides normal plants, there are other-worldly organisms that L-systems can model. Here is one modeling a hairy alien.

Alien { 
  Angle 11
  Axiom x
  x=[@q2@I2-fx]g[@q2@I2---fx]
  f=
  }

The symbol combination "@q" means "multiply the line length by the square root of the following number". The symbol combination "@I" means "multiply the line length by the reciprocal of the following number". The symbol "g" means "move forward instead of drawing".

You might ask why I chose the number "Angle 11" and the string "@q2@I2". For perverse reasons. If you merely replace "Angle 11" by "Angle 8", the resulting L-system produces the famous Dragon curve which is described in a more conventional way later in this tutorial. Another reason I selected this L-system is to suggest to you that, to a limited extent, L-systems can create pictures like those produced by IFS systems (which FRACTINT can also handle directly). Anyway, here is a picture of Alien.

(drawing of Alien)



On to The next chapter or Back to the Tutorial Index

Back to The Fractint Home Page. or back to The Fractint Index Page.

This page maintained by

Noel Giffin,
noel@triumf.ca