GroIMP defines a set of extended turtle commands which are
also part of the package de.grogra.turtle
.
These have no GROGRA counterparts. The following
table gives an overview of the extended commands:
Table 2.2. Extended turtle commands
Turtle command | Meaning |
---|---|
Translate(x, y, z) | Move along the vector (x, y, z)
in local coordinates. |
Rotate(x, y, z) | Rotate by x degrees about the local
x-axis, then by y degrees about the local
y-axis, then by z degrees about the local
z-axis. |
Scale(x, y, z) | Scale along the local x/y/z-axes by the specified values. |
Scale(s) | Scale uniformly along all axes by the factor
s . |
RD(t, s) | Rotate towards the specified direction t
by an amount which depends on the current orientation and the value
s . This implements a directional tropism with
strength s . t has to be an
instance of the Java class javax.vecmath.Tuple3d .
An example is RD(new Vector3d(1, 0, 0), 0.5) which
is a tropism in the global x-direction having strength
0.5 .
|
RP(t, s) | Rotate towards the specified location t
by an amount which depends on the current orientation and the value
s . This implements a positional tropism with
strength s . Again t has to be an
instance of the Java class javax.vecmath.Tuple3d .
|
RN(t, s) | Rotate towards the location of the node t
by an amount which depends on the current orientation and the value
s . This implements a positional tropism with
strength s . Here t
is another node in the graph whose location is used as the target
of the positional tropism.
|
Both the classic and extended turtle commands can be used in the specified form as patterns on the left hand side of a rule. E.g., it is possible to write
Translate(a, b, c) ==> Translate(a+1, b-1, c*2);
In general, it is not the case that one can use such parametrized
patterns on the left hand side. The node classes like
Translate
have to provide special
predicates in order to allow for this. We
will not go into these details for now.