Within GroIMP, a lot of turtle commands and, more general, 3D-geometric objects are predefined. These can be used as nodes in the graph structure.
The classic turtle commands of GroIMP are designed
similarly to the turtle commands of the GROGRA software. These
commands are defined as classes in the Java package
de.grogra.turtle
. Some make use of the
turtle state: When a turtle moves along
a graph and executes commands, it maintains a turtle state. The
turtle state contains a set of state variables, among these are
the length, diameter and color of the cylindrical segments
which are created by the various F
commands.
There are special turtle commands which set state variables, e.g.,
L(x)
sets the length to x
.
For a full description of GroIMP's turtle commands (both classic
and extended), have a look
at the online documentation located at
https://javadoc.grogra.de/rgg/de/grogra/turtle/package-summary.html
.
Table 2.1. Classic turtle commands
Turtle command | Meaning | GROGRA counterpart |
---|---|---|
F(x) | Draw a cylindrical segment of length x .
The cylinder is oriented along the local z-axis
(the turtle's head axis). | F(x) |
F0 | Similar to F(x) . The length is defined
by the length variable of the current turtle state, which in turn is set by
L(x) . | F |
M(x) | Move along the local z-axis (the turtle's head axis)
by a distance x . | f(x) |
M0 | Similar to M(x) . The moving distance is defined
by the length variable of the current turtle state, which in turn is set by
L(x) . | f |
RL(a) | Rotate about the local x-axis (the turtle's left axis)
by a degrees. | RL(a) |
RU(a) | Rotate about the local y-axis (the turtle's up axis)
by a degrees. | RU(a) |
RH(a) | Rotate about the local z-axis (the turtle's head axis)
by a degrees. | RH(a) |
D(x) | Set the diameter of the following segments to
x . | D(x) |
L(x) | Set the length of the following segments to
x . | L(x) |
P(x) | Set the color of the following segments to
x . The specified value x
may be a number which encodes the color by a palette with
sixteen colors.
In addition, GroIMP defines an extended version of
P(x) where x is a material
or shader.
| P(x) |
RG | Rotate towards the negative global z-direction such that subsequent turtle movement will be strictly downwards. | RG |
AdjustLU | Rotate about the local z-axis (the turtle's head axis) such that the local x-axis becomes horizontal and the local y-axis points upwards as far as possible. | $ |
RV(x) | Rotate towards the negative global z-direction by an amount
which depends on the current orientation and the value
x . This implements gravitropism, its strength
being given by x . | RV(x) |