# Tree

by David Dostal

Short link: http://malsys.cz/g/fAO4NZyN

### Comments

comments powered by Disqus### 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 | fun randomize (number, maxDistance) { return number + random(0, maxDistance) -random(0, maxDistance); } lsystem Tree { let tlm = 0.8; //trunkLength multiplier let blm = 0.8; //branchLength multiplier let wm = 0.7; //widthMultiplier let angle = 20; let rotation = 137.5; let rran = 20; //rotation randomness set iterations = 10; set initialAngle = 90; set tropismVector = {0, -1, 0}; set tropismCoefficient = 3; set symbols axiom = /(random(0, 360)) A(10, 1); rewrite A(l, w) to F(l, w) /(randomize(rotation, rran))[+B(l*blm, w*wm)] A(l*tlm, w*wm); rewrite B(l, w) to F(l, w) /(randomize(rotation, rran))[+C(l*blm, w*wm)] B(l*blm, w*wm); rewrite C(l, w) to F(l, w) /(randomize(rotation, rran))[-B(l*blm, w*wm)] C(l*blm, w*wm); interpret F(l, w) as DrawForward(l, w); interpret A(l, w) as DrawForward(l, w); interpret B(l, w) as DrawForward(l, w); interpret + as TurnLeft(angle); interpret - as TurnLeft(-angle); interpret /(r) as Roll(r); interpret [ as StartBranch(); interpret ] as EndBranch(); } process Tree with SvgRenderer; |

### Thumbnail extension

1 2 | process all with SvgRenderer set iterations = 8; |