Copy/Paste the following code to your GroIMP project:
//**********************************************************
/* You will learn:
– 3 variants on how to position lateral branches at another
place than at the end of an object
– the move command M
– the method Translate(x, y, z)
– the modules L() and Mrel, known as turtle commands
*/
module B;
protected void init()
[ Axiom ==> F(10); ]
public void lateralBranch()
[
f:F(x) ==> f
// variant 1: movement without drawing; back by negative number:
// M(-0.6*x)
[ M(-0.6*x) RU(-30) P(2) F(0.3*x) ]
// variant 2: use of Translate, back by negative number:
[ b:B Translate(0, 0, -x/2) RU(30) P(3) F(0.3*x) ]
// variant 3: relative position at the mother shoot, MRel(0.7),
// in relation to the turtle’s step length which is set by L(x).
[ L(x) MRel(0.7) RU(-30) P(4) F(0.2*x) ] ;
]
//**********************************************************