Name | Value | |
---|---|---|
x | ||
y | ||
width | ||
height | ||
d | ||
delta | ||
alpha | ||
close | ||
derivationLength | ||
animate | ||
Name | Definition | |
---|---|---|
+ | ||
- | ||
f | ||
F | ||
X |
virtual_botanical_laboratory © 2017 Huub de Beer <Huub@heerdebeer.org>.
See its website for more information and its repository for its source code.
virtual_botanical_laboratory is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
virtual_botanical_laboratory is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with virtual_botanical_laboratory. If not, see <http://www.gnu.org/licenses/>.
This is a short manual of how to use the virtual_botanical_laboratory
. For more information see the website.
The virtual_botanical_laboratory
has a very simple and bare-bones user interface. It has been added more as an afterthought than that it has been designed with user experience in mind. (Feel free to create a better interface, virtual_botanical_laboratory
is free software after all.)
The interface is meant to show the generated images while giving the user access to the underlying L-system and the configuration of the interpretation of that L-system.
The user interface consists of five tab pages:
On the main tab page, labeled with ♣, you can see the rendered L-system (see figure below). It also has some buttons to control the L-system and export the rendering.
The following “file” actions are available:
The following “control” actions are available:
derivationLength
. You can set that option on the Interpretation tab.You can view and edit the L-system definition on the L-system tab (see figure below).
You can view and change the configuration of the interpretation on the Interpretation tab (see figure below).
On this Interpretation tab, there are two sections:
Properties, which is an editable list of properties you can set, update, or remove. These properties include:
F
command, d+
and -
command, deltaCommands, which is a list of all commands defined in the L-system. You can edit their definitions. Note. the this
refers to the [Interpretation](https://heerdebeer.org/Software/virtual_botanical_laboratory/documentation/api/Interpretation.html)
.
The commands F
, f
, +
, and -
are defined by default. If you want to change their behavior, you have to introduce a new symbol in the L-system and write its command’s code. You can call the default implementation as follows:
this.getCommand("F").execute(this);
You can read about the virtual_botanical_laboratory
and its license on the About tab (labeled i).
The language to define a L-system follows the language described in the (first chapter of the) book The algorithmic beauty of plants (Prusinkiewicz and Lindenmayer 1990). There are some notable differences:
F
followed by another F
, write F F
rather than FF
.Forward
instead of F
if you so please.Next the features of the L-system definition language are briefly introduced. For a more thorough overview, please see the (Chapter on reading Prusinkiewicz and Lindenmayer 1990)(#reading).
A basic L-system is defined by three parts:
F
, -
, and +
.F F
.F -> - F + F
.You specify the above L-system as follows:
my_first_lsystem = lsystem(
alphabet: {F, -, +},
axiom: F F,
productions: {
F -> - F + F,
- -> -,
+ -> +
}
)
Identity rewriting rules like + -> +
can be omitted. If there is no rewriting rule specified for a symbol in the language, the identity rewriting rule is used by default.
For documenting purposes, you can also add a description to the L-system definition. So, the above example can be rewritten as:
my_first_lsystem = lsystem(
description: "This is my first L-system definition!",
alphabet: {F, -, +},
axiom: F F,
productions: {
F -> - F + F
}
)
One of the interesting features of L-systems are branching structures. To define a sub structure, place it in between [
and ]
. For example:
expanding_tree_circle = lsystem(
alphabet: {F, -, +},
axiom: F,
productions: {
F -> F [ + F] - F
}
)
This will generate some expanding circle of branching lines.
Stochastic L-systems. To bring some randomness into your generated plants, you can configure different successor patterns for one symbol and indicate the likelyhood these successor patterns are chosen by prepending each successor pattern with a numerical probability. The sum of these probabilities must be one (1).
For example, in the previous example you can choose circling left over right more often as follows:
expanding_random_tree_circle = lsystem(
alphabet: {F, -, +},
axiom: F,
productions: {
F: {
0.4 -> F [ + F] - F,
0.6 -> F [ - F] + F
}
}
)
Context-aware L-system. You can choose a different successor pattern depending on the context wherein a symbol appears. For example, a F
after a +
can be replaced by a f + F
, and a F
after a -
can be replaced by a F - f
. You can indicate which symbols should be ignored when checking the context using the ignore keyword. For example:
expanding_random_tree_circle = lsystem(
alphabet: {F, f, -, +},
axiom: f,
productions: {
- < F -> F - f,
+ < F -> f + F.
f -> f [ - F] f [+ f]
},
ignore: {f}
)
The left context is indicated by the string before the <
operator. You can indicate the right context by a string after the >
operator (not shown in the example).
Parameterized symbols. To move information through a derivation, you can user parameterized symbols. For example:
dx = 10;
ddx = 0.5;
expanding_random_tree_circle = lsystem(
alphabet: {F'(x), -, +},
axiom: F'(100),
productions: {
F'(x): x > 100 -> F + [ F'(x - dx) - F'(x / ddx)],
F'(x): x < 100 -> F - [ F'(x + dx) - F'(x * ddx)]
}
)
Here the F'
symbol has parameter x
. The successor to F'(x)
differs depending on the value of x
. These rewriting rules are conditional. You can define symbols with one or more parameters. Conditions can be complex by using Boolean operators and
, or
, and not
.
Also note the definition of global values dx
and ddx
.
The power of parameterization is realized best by making using the parameter in the interpretation to change the behavior of the commands. For example, we can define the F'
command as follows:
this.d = this.d + x;
this.getCommand("F").execute(this);
Prusinkiewicz, Prezemyslaw, and Aristid Lindenmayer. 1990. The Algorithmic Beauty of Plants. New York: Springer-Verlag. http://algorithmicbotany.org/papers/#abop.