module A(super.radius) extends Sphere { {setShader(GREEN);} } module Stem(super.length, float diameter) extends Cylinder(length, diameter/2).(setShader(stemShader)); module Flower(float length, float diameter) ==> leaf(length, diameter).(setShader(flowerShader)); const Node letters = namedNode("letters"); const ShaderRef stemShader = shader("stemShader"); const ShaderRef flowerShader = shader("flowerShader"); protected void init () { [ Axiom ==> ; ] de.grogra.vecmath.geom.Volume v = volume(letters); for (int i:(1:2000)) { float x = random(0, 0.602); float y = random(0, 0.203); float z = height(v, x, y); if (z > 0.05) { // [ ==>> ^ A(0.01).(setTransform(x, y, 0)); ] // [ ==>> ^ Translate(x, y, 0) Axiom; ] } else { // [ ==>> ^ Translate(x, y, 0) Cylinder(0.05, 0.001); ] [ ==>> ^ Translate(x, y, 0) Sphere(0.015).(setColor(0x008000)); ] } } derive(); for (int i:(1:5000)) { float x = random(0, 0.602); float y = random(0, 0.203); float z = height(v, x, y); if (z > 0.05) { // [ ==>> ^ A(0.01).(setTransform(x, y, 0)); ] z = (float) max((* s:Sphere, height(volume(s), x, y) *)); [ ==>> ^ Translate(x, y, 0) Axiom; ] // [ ==>> ^ Translate(x, y, 0.015) Sphere(0.003).(setColor(0xFFFFFF)); ] } } } public void run () [ // Axiom ==> A(0.005); // A(x) ==> Cylinder(x, 0.001) [RU(30) RH(90) A(x*0.8)] [RU(-30) RH(90) A(x*0.8)]; Axiom ==> [ RU(random(-5, 5)) Stem(random(0.03, 0.04), 0.001) RL(random(70, 100)) RU(random(70, 100)) Translate(0, 0, -0.005) Flower(0.01, 0.01)]; ]