3 ms·
Drawing fractals in the browser with L-systems and ES6
- mfgs 8y agoNice. Can L-systems support random variations? The code in the example produces the same fractal each time as the L-system is deterministic.
- clickok 8y agoYes, 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 8y agoL-systems have also been used to make music.
- vanderZwan 8y agoThis 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
- ht_th 8y agoAwesome! 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.
- teapot7 8y agoThe 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.