2  Skeleton design

2.1  What the skeleton is

Skeleton of natural plant object is an abstract object which determines space lay-out of future model (that means its dimensional proportions)and dependencies of individual parts of plant model. Skeleton consist of parts called compponents which are its elementary indivisible units. Skeleton determines character and fundamental look of future model and that is why it's so important. One must consider carefully skeleton design to obtain model of good quality.

Figure 1: Skeleton of simple straw.

2.2  Methods of skeleton design

There are more ways how to design skeleton of plant model. I have created desription language based on Lindenmayer systems (L-systems). This language is called SDL (Skeleton Description Language) and this paragraph is discussing principes of skeleton design using SDL. L-systems come from formal grammars and they offer simple and strong enough mechanism for modeling living orgamisms in general. It is necessary to bring this formalism into use. This document is not intended to exactly explain how does L-systems work. For further information about L-systems see [1].

As mentioned in section 2.1 skeleton consists of components and determines their dependences. Components are elementary indivisible units but they do not need to have the very same features. That is why it is useful to divide skleleton design into two parts. Features of components are specified in th first part and their dependencies are described in th second part. I will talk about second part at first.

2.2.1  Component dependencies description

Description component dependencies is part of skeleton design which is based on L-systems. Grammar and its rules are used for determination of dependencies between components. Rules of this grammar are consisted of nonterminal symbols only. Each nonterminal symbol represents one component and rules describe their dependencies. In other words, rules mean patterns which will be used for skeleton construction. Deriving mechanism of this rules is the same as deriving mechanism of formal grammars. That means that during proces of derivation the nontermial symbol in output sequence is replaced by its right side of relevant rule.

Meaning of nonterminal symbols is rather different from meaning of nonterminal symbols in formal grammars. Each nonterminal symbol represents one component described by its features. Features of components will be discussed in section 2.2.2. It is necessary to understand features passing at this time. Relations of components are described by rules of grammar of L-system. Master component stays on left side of this rule and slave component (or components) stays on right side of relevant rule. That means that during process of derivation slave components will deduce their features from master component. For better understanding follow this example. Let's have a rules:
 S  -> A

 A  -> A
Derivation will proceed like this:
 S -> A0 -> A1 -> A2 ...
Components A0, A1, A2 , etc. are derived from the same nonterminal symbol but they have another features. Nonterminal S (representing one compomnent) is starting nonterminal symbol, as you can see, and its rule is used at first. Component A0 will derive its features from component S in this step. Then the second rule is used repeatedly so that component A1 will derive its features from component A0 , component A2 will derive its features from A1 , etc. Note that this process of deriving is neverending and it is not important at this level of skleleton design to stop it. This is a way how to simulate grow of plant because you can stop process of deriving after different count of iterations.

Figure 2: Example of grow of skeleton.

It is usefull to change implicit master-slave relations of nonterminal symbols sometimes. SDL enables this by using so called technique of branching. Branching is technique for explicit change of nonterminal dependencies. That means that master nonterminal for some slave nonterminal symbol on right side can be also found on right side. It must be used two stack symbols to change master nonterminal for one or more slave nonterminal symbols. This symbols are brackets (``('' and ``)''). I will demonstrate this facts on example. Let's have a rule:
 S  -> ( A B (C D) E )
I use branching in this rule. Nonterminal S is master for nonterminal symbols A, B and E. Symbol B is master for nonterminals C and D. Components repesented by nonterminals A and B will be created during process of derivation at first, and component B will be used as master for components C and D immediately after. Technique of braching is good for creating more complicated branch structures in one step of derivation process. For further informations see simple example in section .

2.2.2  Component features description

As mentioned before, components represented by nonterminal symbols have some features. You can read some facts about component features in this section. Features are very important for model design and they determine character and look of fututre model. Some basic atributes are needed to describe curves (for examle: skeleton components are represented by curves) in 3D scene. SDL supports four features at this time. There is begining of component, lenght, vertical and horizontal angle of rotation. It is very important to know that feature of component is specified as relative difference from master component feature. In other words, all atributes of component feature must be considered as a value of variation from relevant atribute of master component. This is one of the most important principle of SDL. Now I can describe meaning of each component in this context.

Atribute of begining means location where slave component begins on master component. Atribute of lenght determines lenght increment or decrement of slave component with respect to master component and angles of rotation are determined in the same way. Absolute values of component features are determined during process of derivation and we can talk about it as about the process of interpretation in this context. Determination of absolute values of component features is the main difference between derivation and interpretation, if we talk about derivation we mean replacing nonterminals only.

SDL also offers methods to achieve variability of constructed models at this level of skeleton description. This method is called mutating. You can delimitate valid interval for some atribut values instead of one value only. One value from this interval will be choosen accidentally in each step of process of interpretation. One or more atributes of component feature can be signed as mutating, e.g only atribute of horizontal rotation angle can be assigned for mutating. (see Figure 3)

Figure 3: Example of mututating.

2.2.3  Syntax of SDL

Exact specification of SLD syntax using grammar:

 S
 ->
 define {A
 A
 ->
 LB; A | }F
 B
 ->
 id [ C
 C
 ->
 XD | NULL]
 D
 ->
 ,E | ]
 E
 ->
 XD
 F
 ->
 rules {G
 G
 ->
 H; G | }
 H
 ->
 id - >  I
 I
 ->
 (J)
 J
 ->
 id KJ | e
 K
 ->
 I | e
 L
 ->
 #const_ver | #const_hor | e
 X
 ->
 numY
 Y
 ->
 :Z | e
 Z
 ->
 num

I can write a few words about SDL syntax at this time. I do not want to be much concrete because this work is not finished yet and some details can be changed. At this time, SDL source is divided into two parts as mentioned in section 2.2. These parts are called blocks. First block is introduced by keyword define. This block is obligatory and you must describe component features in this block. First, the name of nonterminal symbol is specified and then description of feature. Feature is bounded by symbols [ and ]. You need to specify begining of component, length, vertical and horizontal rotation angle in this order. You can specify feature either as one value or as interval for mutating. This interval is described by middle value and maximum deviation from middle value separated by symbol ``:''. Second block, that follows, is block introduced by keyword rules. This block is also obligatory and you can describe component dependencies in this block. This is done by writing rules. You specify left side of rule at first and then right side of relevant rule. Only one nonterminal symbol can stay on left side of rule. Left and right side are separated by symbol ->. You must use stack symbols and then to specify master component even if you do not want to change implicit master - slave component relation (see section 2.2.1). You can see some symbol in SDL grammar as #const_hor, #const_ver or NULL symbol. Meaning of this symbol is topic of evolution and future of this symbols is unwarranted.

Figure 4: Example of use of correction function.

2.2.4  Simple example

I will demonstrate all described facts on simple example. Figure 1 show result of interpretation of following simple SDL source code in few generations.

```// source for describing simple straw skeleton
define{
start[0,1,0,0];
straw[0.5:0.3,0.8:0.3,0,30:10];
}
rules{
start -> (straw);
straw -> (straw);
}
```