tutorial: documentation: MoSS


TUTORIAL CONTENTS
3.0 Running the Plugin
   3.1 The Data File and its Parameters
   3.2 The Grammar
   3.3 The Filters
   3.4 The Surface Option
   3.5 The Tree Option
   3.6 Examples of Grammar Inputs


back to Documentation Main



3.0 Running the Plugin

3.1 The Data File and its Parameters
In the data file, "***" marks a comment, i.e. ***This is a comment***

The sequence of the different parameters does not matter. What is important is that the key word at the beginning of the line is followed by a = , then the value, then a period, which terminates this data. i.e. KEYWORD=VALUE.

An example of data.txt

A list of data.txt parameters and possible values:

GENERAL PARAMETERS
FILTER=0. Filter is toggled on/off with 0/1
THRESHHOLD=10. Threshold is the distance for points to be filtered
SHARED=4. shared is the no of points on the same vertex for filter3
FILTER2=0. filter2 toggled on/off with 0/1
FILTER3=0. filter3 toggled on/off with 0/1
FACET_SIZE=4. number of points which form a surface (grammar rule S or T)
MESH=0. toggles the creation of a mesh on/off with 0/1
TREE=0. toggles the generation of a fractal tree on or off 0/1
GENERATION LIMIT=10. sets the number of generation for the L-System (not the tree)
CHILDREN SPAWNED FOR TREE MODE=4. sets number of branches for the tree mode

ANGLES / 10 (275 means 27,5 degrees).
The syntax for numbers is to leave out the comma.
ALPHAA=300. the angle for turning left or right of the turtle
BETA=300. the angle for rolling left or right of the turtle
GAMMA=300. the angle for pitching up or down of the turtle

BOUNDING BOX VALUES / 10 (44 means 4,4).
The bounding box limits the growth of the L-system to a box
X1=-120. starting one corner specified with X1 Y1 Z1
Y1=-100.  
Z1=-100.
X2=120. and the other corner diagonally across from the first
Y2=100.
Z2=300.  
   
SX0=0. the starting point of the growth is specified in SX
SY0=0. for multiple surfaces SX is incremented by one for
SZ0=0. each additional system SX0 ... SX1 ...

***GRAMMARS***.
The Grammar specifies the actual growth
X=f&&&fK. the axiom is read in and executed replacing each letter
K=Yf[>>>f<<<fY] [<<<f<<<fY]K. with its rule if there is one specified
Y=F[^^^F]>>>F[^^^]Y. []safe and restore the state of the system (for branching)
S=f>>>f>>>f>>>f. S and T are reserved for surfaces and are unaffected by affectors and repellers

***REPELLERS/ATTRACTORS***.
R0-X=0. R stands for attractor and repellers. R is incremented
R0-Y=-10. by one for each new attractor and repeller R0 .. R1. Its
R0-Z=10. power being positive or negative determines whether it is
R0-POWER=0. an attractor or an repeller. (pos attracts neg repels)
R1-X=-100. XYZ sets its position and the power the zone of influence
R1-Y=-30. on the growth
R1-Z=35.
R1-POWER=0.  


3.2 The Grammar
The syntax of the grammar consists of the following symbols:

X, W, Y, K are letters for which rules can be defined. The first Letter defined is the axiom that is read in by the interpreter
<> turns the turtles orientation left/right with the angle specified in alpha multiple signs have an accumulative effect > = 30,>> = 60, > = 0 degrees for alpha=30 (in data.txt 30 degrees would be written 300)
- + rolls the turtle along its length axis at an angle specified in Gamma. accumulative in the same manner as <>
^& pitches the orientation of the turtle ^ up and down & at the angle specified in BETA accumulative in the same manner as <>.
f moves the turtle on unit forward in its current orientation. With the forward movement the direction of movement becomes the new local orientation of the turtle (what was up from its former state now is forward) this takes only affect after f or F have been called. (so >^f is not the same as >f^)
F is the same as f only it draws a line for its path of movement.
[
]
pops a state on the stack. Meaning the current orientation of the turtle is stored ] and with this sign returned. This means f[<f]f moves forward saves the position and orientation it is at turns right and goes forward and then returns to the saved position and orientation going forward one step in the initial direction this causes a branching to take place
S in this grammar reserved for the creation of a surface polygon of n vertices, where n is defined in facet_sides in the data.txt file. The interpreter will attempt to create a closed polygon out of the moves defined here using small f (a triangle with alpha at 30 would for instance be f>>>>f>>>>f forward turn 120 degrees to the right move forward turn right 120 move forward. The number of f's have to match the facet_number otherwise nothing will be drawn. That means the starting does not have to be reached again)
T same is true for T as for S.


3.3 The Filters
    Through the development of the plugin there have been several stages in trying to optimize the interplay of L-system grammar and attractors and repellers with a usable outcome. As always, it is difficult to exactly specify what is usable and what is not, therefore there are different not necessarily coherent implementations of experimental nature in this plugin.

    The main problem comes from the distortion of the geometry specified in the grammar. Due to the effects of the attractors and repellers, surface elements which should form a closed surface in the grammar become disjoint. The three filters try to solve this problem with different approaches aiming at closed surface displacing the surface vertices to match their neighbours.

First Implementation "filter"
Filter parses the set of surface vertices after their initial grammar generation and joins them within a certain radius of each other, as specified in the threshold parameter. If there are more than three vertices, the filter tends to leave gaps. The advantage of filter is that it works with all grammars since it is not dependent on the number of surface vertices. It also joins any surfaces close together which causes surfaces from different lines of growth to be stitched together.

Second Implementation "filter2"
It is an optimization of the principle of the first filter, specific for the use of hexagonal grammars. It averages the three closest vertices into one point thereby closing gaps. If the distance is too big, the gap stays open.

Third Implementation "filter3"
The third filter is based on the idea of using the links which derive from the non-deformed grammar as the pattern for joining the surfaces after the attractor and repellers effect. Therefor it is guaranteed that a grammar that forms a continues surface in an undisturbed run will form a continues surface in the disturbed run as well, making the outcome more predictable.

The filters are to be used one at a time (not in parallel) or switched off completely

3.4 The Surface Option
    The filters in combination with the L-system and an appropriate grammar form a surface. The plugin still has a secondary function which is the

3.5 The Tree Option
    if the tree option in data.txt is toggled on it produces a fractal tree using the child_node for determining how many branchoff are generated at each joint.

3.6 Examples of Grammar Inputs
a hexagonal grammar based on alpha=300 beta=300 gamma 300
it generates a continues honeycomb-like surface growing from a point with the parameter
filter3= 1
facet_nodes=6
shared=3
Grammar:

X=f&&&f>>>>>>f[K]>>[fK]>>[K]>>[fK]>>[K]>>[fK].
K=Y>>f<<fK.
Y=S<<f>>fY.
S=<<f>>f>>f>>f>>f>>f.

a continues rectangular grid example

filter3= 1
facet_nodes=4
shared=4
Grammar:
X=&fK>K>K>K.
K=Y>f<K.
Y=SfY.
S=f>f>f>f.



home   |   media : publications   |   files : documentation