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]

Simple but nice production rules iterations. Very good blog. All the best!

ReplyDeletethank you for the compliment :)

ReplyDeletevery nice

ReplyDeleteDid you use c++ to code ???

ReplyDeleteYes, I do use C++ and OpenGL.

ReplyDeletei am trying to make a 2d tree without leaves. something very simple to start with in c++. can you point me to any tutorial i can see examples of such things?

ReplyDeletehello, is it possible to have the source for one of these trees?

ReplyDeleteThanks for posting this! I was too bored but now I'll try to design this tree. Keep posting.

ReplyDeleteHello, could you please share the source code also? thanks

ReplyDelete