Lily of the valley

Loading 3D model
of Lily of the valley

Source code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
lsystem Lily extends Branches {
 
set symbols axiom = A;
set iterations = 16;
set cameraPosition = {185, -290, -271};
set cameraUpVector = {0.99, -0.16, 0};
set cameraTarget = {201, 28, -152};
 
interpret F G (age) as DrawForward(1.3^age, age / 2, #00AA00);
interpret L(x) as lsystem Blossom(x);
interpret / as Roll;
interpret + as Yaw;
 
rewrite A to F(0) [ /(30) L(0) ] F(0) [ /(-30) L(0) ] +(8) A;
rewrite L(x) to L(x + 0.7);
rewrite F(age) to F(age + 1);
 
}
 
abstract lsystem Blossom(i = 12, color = #FFFFFF) extends Polygons {
 
set symbols axiom = S Q Q Q Q Q;
set iterations = i;
let compensationAngle = max(0, 90 - i*5);
 
interpret F as DrawForward(1.2^i, 2, #00ee00);
interpret X as DrawForward(1.35^i + 2, 1, #00ee00);
interpret f as DrawForward(1.05^i - 0.5, 1, #55ee00);
interpret G as MoveForward(1.2^i);
interpret + as Yaw(15);
interpret | as Yaw(180);
interpret & as Pitch(25);
interpret ! as Pitch(compensationAngle);
interpret / as Roll;
 
rewrite Q to [X &(40) a] | [ ! A ] /(72) [ ! B ] | ;
rewrite S to + F S;
rewrite A to [ & G A <(color) . ] . ;
rewrite B to B & . G . > ;
rewrite a to &(8) f a;
}
 
process all with ThreeJsRenderer;

Thumbnail extension

1
2
3
4
5
process all with ThreeJsRenderer
set cameraPosition = {134, -171, -157}
set cameraUpVector = {1, -0.07, -0.01}
set cameraTarget = {127, 6, -61}
set iterations = 14;