Hacker News new | past | comments | ask | show | jobs | submit login
Lindenmayer Systems (rue-a.github.io)
141 points by susam 10 months ago | hide | past | favorite | 34 comments



Ooh this is one of my favourite topics :).

I had a side project a while back which has a few fun presets . You can click-and-drag to animate the pattern by changing its branching angle:

http://benvan.co.uk/lsys/#?i=30&r=L%20%3A%20S%0AS%20%3A%20F%...


This is really fantastic work!


the ability to change the angle on yours by dragging is so cool!


If you're interested in L-systems you may also enjoy reading about Shape Grammars. Sort of an evolutionary dead-end in terms of system design, but intriguing. As far as I can tell they were basically superceded by other types of programmatic or parametric design systems. Some references:

- http://web.mit.edu/~haldane/www/icerays/

- https://vincentmai.com/Shape-Grammar

- https://wiki.ece.cmu.edu/ddl/index.php/Shape_grammar

- "Shape: Talking About Seeing And Doing" by George Stiny

- https://www.slideshare.net/schase56/dcc-2010-grammars-worksh...

- https://www.cambridge.org/core/journals/ai-edam/article/abs/...


Thanks for sharing, I never heard about this before! The Wikipedia article on shape grammar has a link to an old website[1] from a workshop at MIT that links to many more interesting resources, including the “Shape” book by George Stiny you mentioned as a free download (not sure if the author agreed to this, so I’ll just use it as a reading sample and buy the book if I like it), course material, presentations, etc.

I also found a more recent book[2] by George Stiny called “Shapes of Imagination: Calculating in Coleridge's Magical Realm” that is also about shape grammars and is actually open access. Coming from a design background, I am sure to take a closer look at some of this stuff.

- [1] https://web.archive.org/web/20190405160829/http://shapegramm...

- [2] https://direct.mit.edu/books/oa-monograph/5489/Shapes-of-Ima...


L-Systems are still usefull in plant science if extended a bit. Here a software package one can try: http://www.grogra.de/


This is great, thank you. Do you actually use this software? I’m very curious to hear about real world applications of these generative systems.


This is a fantastic collection of links and makes me wish there were one modern site that summarized all this work, maybe with a working Javascript demo.


That's on the long list of blog posts that I've never written. Feel free to start with these and go forward! Make sure to get a physical copy of Shape, it's one of the most baffling textbooks I've ever tried to read.


I did a solo project on L-Systems for my bachelors degree at university two decades ago (sadly looks lost to time).

Embedding different symbols you can add more than just draw and rotation in one plane:

* Rotation in 3D space * Stochastic steps * Stacks to remember where the cursor was and return when done drawing a branch * Depth-limited steps (can simulate gravity's effect on tree branches)

With this I was rendering biological life (trees, coral etc) in three dimensions.

I also tried applying it to MIDI, with "draw" being play a note, and symbols going up and down the scales. It made for interesting fractal music, but I never figured out the best approach for, say, a decent-sounding fugue.


I designed and teached a bachelors class in Generative Grammar Structures for few years at Sofia University. And L-systems were part of the curriculum. We also had Chris Coyne’s CFDG and Structure Synth in the classes.

Interestingly l-systems are semi-Thue grammars, not Chomsky grammars and their inventor was a biologist modelling tree growth.

The class made huge impact on everyone’s ability to comprehend discreet math concepts such as state space, regex, FSMs and alike by actually showing these visually. I’m convinced CFdG has to be included in higher school curriculum the same way spatial analysis augments/complements greatly classic geography courses.


Ooh, I did this too a while ago: https://eliben.github.io/lsystem/

This has some pre-sets you can examine that draw well-known fractals


+1 for the presets.


These are quite beautiful.

I remember I was on a "fractal" high when I first discovered graphics programming and relied on the exercises in this book https://archive.org/details/advancedfractalp0000stev

It had a chapter on L-systems with some very nice examples. One of my earliest programs which I put online was a Tkinter based GUI to do this. https://github.com/nibrahim/PFractL


I was really into this a few years back. This particular variety was somewhat famous for a while.

http://www.fleen.org/generative_art_project/aza.png

Shape grammar building system stuff.

IMO it's the coolest thing to happen to 2D geometry since the Cartesian grid.

Here's more

https://twitter.com/pickover/status/1662465007500574723


I once tried my own L-system generator on lisp! Take a look

https://github.com/FdelMazo/cl-aristid


Very cool. I must check this out.

I implemented some L-system features in my 3D Common Lisp system: https://github.com/kaveh808/kons-9


This is pretty tight


I first heard about L-Systems a number of years ago in the context of an elective masters course on computer graphics, where we briefly touched on approaches for procedural geometry generation.

The way it was introduced to us, was to basically apply a parsing grammar backwards, IIRC using an iterative match-and-generate approach, to produce a command stream for a renderer.

I remember finding the idea of using a parsing grammar in this way quite interesting and wondered about other areas where this could be used. For some reason, programmable shell-completion came to my mind, i.e. encode a command line options for a program using a recursive grammar with "expand a file path here" or "call an external helper (e.g. git)" as terminal symbols. Throw in capture groups for terminals and this kills most use cases where the imperative approach in Bash gets very tedious.

I keep recalling that idea from the back of my mind every time I see L-Systems featured on HN. I guess/hope most newer shells learnt from Bash and already do something like this, but I honestly was just too lazy to investigate this any further (so far).


The way I understand it is applying Chomsky grammar rules (eg. A -> ABF; B -> CFF) but in singular passes rather than expanding to its full length. Eg:

Let --- A -> BFC B -> CF+ C -> F-

0. ABC 1. BFCCF+F- 2. CF+FF-F-F+F- 3. F-F+FF-F-F+F-

By drawing/considering these iterations you can model cell/biological growth over time; applying the grammar in its whole immediately would only get you to the end result, plus would never end if you had fractal/infinite sequences.



Related. Others?

Evolving Lindenmayer Systems - https://news.ycombinator.com/item?id=20588039 - Aug 2019 (15 comments)

Lindenmayer systems - https://news.ycombinator.com/item?id=16002532 - Dec 2017 (9 comments)

Four L-system fractals in LaTeX - https://news.ycombinator.com/item?id=9716780 - June 2015 (5 comments)



Always fun to see an interactive L-System implementation!

This one seemed to have odd line weights to me... until I realized that the default F-Reproduction value seems to have a bug: I think it's supposed to be "F[-F]F[+F]F" instead of "F[-F]F[+F][F]"?

- https://github.com/rue-a/L-Systems/blob/d725d7da9a2c96afabfc...


Renderers don't support it, but I wonder if it's generally possible to encode such an L-System simply as a self-referencing svg group.


They need a runtime argument (such as iteration count), otherwise they'll generate indefinitely.


Oh saw a lot of these when dabbling with fractint. Never could figure out how and why, but they were beautiful nonetheless on my mighty VGA!


Hmm, my dollar: http://www.alsog.de/

Or see the examples page: http://www.alsog.de/feat_examples.php


Here's an Observable notebook with a bunch of examples. [1]

[1] https://observablehq.com/@kelleyvanevert/l-systems-2



here's one I did some time ago: https://m__nick.gitlab.io/l-systems/#Multi

It's not as complete as the one from benvan...


How do I make it draw pretty things? What to I type in?


Are simple esolangs like BF also L-systems?


BrainFuck? no. L-systems are a string rewriting language basically. L-systems though are more about the patterns they make when they're interpreted more than anything else.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: