
Drawing fractals in the browser with L-systems and ES6 - vinnyglennon
https://eng.qualia.com/drawing-fractals-in-the-browser-with-l-systems-and-es6-6cecfd74e084
======
ht_th
Awesome! I've had a lot of fun last year building my own "virtual botanical
laboratory" in JavaScript (see
[https://heerdebeer.org/Software/virtual_botanical_laboratory...](https://heerdebeer.org/Software/virtual_botanical_laboratory/)).
It is based on the book "The algorithmic beauty of plants" by Prusinkiewicz &
Lindenmayer (1990). Quite an interesting read. You can find that book on-line
as a PDF here:
[http://algorithmicbotany.org/papers/#abop](http://algorithmicbotany.org/papers/#abop)
)

It took me many a day at the local hacker space dedicated to building the
software, but as it is so intriguing, I got a lot of comments and interest
from other hackers as well. There's just something awesome about simulating
life-like structures on a computer.

------
vanderZwan
This reminds me of my favourite indy game that was never released: _How To Be
A Tree_

[https://forums.tigsource.com/index.php?topic=38310.0](https://forums.tigsource.com/index.php?topic=38310.0)

------
teapot7
The blog post seems to be pretty much a recreation of examples from the The
Algorithmic beauty of Plants, but I didn't notice the author giving any credit
to the original source.

------
mfgs
Nice.

Can L-systems support random variations? The code in the example produces the
same fractal each time as the L-system is deterministic.

~~~
clickok
Yes, you could have different possible production rules for a given symbol and
sample from them according to some distribution. You could also just randomly
perturb/fuzz a given iteration of the system.

A deterministic system is nice, however, because you can make changes to the
production rules and rendering without having to worry about as many possible
outcomes (introducing stochastic production rules increases the number of
possible outputs combinatorically). This is not too much of a problem if
you're just making cool fractals for fun, but if you're doing procedural
generation with L-systems then you have to keep an eye out for degenerate
cases. For example, if you're generating foliage this way, you might get
plants that grow into the ground or in weird non-biological patterns.

------
pmoriarty
L-systems have also been used to make music.

