Friday, March 31, 2017
Modeling a Tree using L System
Modeling a Tree using L System
An L-system or Lindenmayer system is a parallel rewriting system, namely a variant of a formal grammar (a set of rules and symbols), most famously used to model the growth processes of plant development, but also able to model the morphology of a variety of organisms. [wikipedia]
When using this model, we have to define a set of grammar rules that will be used to describe the growth of the branches of a tree. The rules that we define will later be implemented as the growth of the tree in an iterative fashion. In this system, we define these following alphabets that will be used in the production rules:
f : create branch
l : create leaf
[ and ] : define a set of local area/branch. The definitions of the area are put inside the [ and ]
+ and - : rotate the branch right/left in x-axis
^ and v : rotate the branch up/down in y-axis
<> : twist the branch left/right in z-axis
By using the symbols above, we can begin to create a tree with our system. But before that, we also have to define several properties that are also important in generating the tree, which are:
- The number of production rules iterations, for determining the level of the branches,
- The angle, for determining branch curves, and
- The radius of the branches and the decreasing value of it, in an iterative way The length of the branches
The following are several examples of the production rules that are used using the system:
Tree A
Angle : 25
# Iterations: 6
Branch radius: 0.02
Branch radius reduction: 0.0015
Branch length (height): 0.15
Initial value : fffffA
Production rules : A = f[++Al][--Al]>>>A
Tree B
Angle : 30
# Iterations: 10
Branch radius: 0.01
Branch radius reduction: 0.001
Branch length (height): 0.16
Initial value : fA
Production rules : A = f[^Bl]>>[^Bl]>>A, B = f[-
Tree C
Angle : 15
# Iterations: 13
Branch radius: 0.02
Branch radius reduction: 0.0015
Branch length (height): 0.15
Initial value : fA
Production rules : A = ^fB>>>B>>>>>B, B = [^^f>>>>>>A]
Available link for download