L-System Simulations(eliben.github.io)
eliben.github.io
L-System Simulations
https://eliben.github.io/lsystem/
18 コメント
I've been trying to build plants using procedural generation for a project. I feel like everyone suggests L-Systems but I feel like it's good for making random alien plants that you can vaguely tweak. But they're not good for plants that you actually want to make look like something specifically and grow uniquely and progressively.
I have a bunch of plant examples here http://blog.rabidgremlin.com/tags/l-systems/
The link to Laurens Lapre's LPARSER is dead. Is there a more up-to-date one? I couldn't find it with a brief search.
mmm, I have it on disk from a POVRay book I bought like 20+ years ago.... I wonder if the Internet Archive has it ???
Try to get a copy of the first (and second, third?, for the pic of Aristid) proceedings of the artificial life conference. It demonstrates what You are searching (real plants).
I will check it out thanks
Could you elaborate a bit more? Do you mean a paper?
I can't figure out the grammar. I wanted to do the Hilbert curve at https://en.wikipedia.org/wiki/Hilbert_curve:
Alphabet : A, B
Constants : F + −
Axiom : A
Production rules:
A → +BF−AFA−FB+
B → −AF+BFB+FA−
I thought it might be: A=|+[B]|−[A]|[A]-|[B]+
B=|−[A]|+[B]|[B]+|[A]−
but that doesn't work, and I don't know what's wrong.I tried for a bit and couldn't get it to work either.
The dragon curve example is a lot more complicated than the simplest definition, which is a hint. I don't even know exactly what | or [ or ] are supposed to do here.
Here's a version in Go instead: https://github.com/deosjr/GenGeo/blob/master/gen/lindenmayer... Which renders into: https://github.com/deosjr/GenGeo/blob/83c77f9433e569b30f71b3... (see Algorithmic Beauty of Plants for way more examples)
Here's a version in Go instead: https://github.com/deosjr/GenGeo/blob/master/gen/lindenmayer... Which renders into: https://github.com/deosjr/GenGeo/blob/83c77f9433e569b30f71b3... (see Algorithmic Beauty of Plants for way more examples)
The rules are in https://eliben.github.io/lsystem/rules.js and the evaluation is in https://eliben.github.io/lsystem/lsys.js It looks like f and g are special rules for moving with the pen down or the pen up.
I was able to get it working, I think:
axiom: a
rules:
a = +b|-a|a-|b+
b = -a|+b|b+|a-
initial angle: 90
angle change: 90
scale: 1
simulation depth: 4
axiom: a
rules:
a = +b|-a|a-|b+
b = -a|+b|b+|a-
initial angle: 90
angle change: 90
scale: 1
simulation depth: 4
That did the trick - thanks! I couldn't figure out what the [] meant in this context and thought it was to make a recursive call.
(I've been working on basic space-filling curves, and came across that Wikipedia page last week, which is about all I know about L-systems.)
(I've been working on basic space-filling curves, and came across that Wikipedia page last week, which is about all I know about L-systems.)
Wow never heard of space filling curves. Yet another rabit hole to go into.
Just posted my code as a "Show HN" at https://news.ycombinator.com/item?id=36762283 . The actual project is at https://hg.sr.ht/~dalke/rectfillcurve . I've implemented a few space-filling curves and wrapped them into an iterator API.
nice work! , I will post mine :
https://m__nick.gitlab.io/l-systems/#Algle
here is the grammar:
here is the grammar:
Pattern Production :
0123456789 draw a line
[ push turtle state
] pop turtle state
+ turn angle
- turn -angle
* scale direction and distance up
/ scale direction and distance down
b brighten
d darken
c hue color -1
C hue color +1
[ABD-Z][ae-z] variables for patterns rewritingThe mobile version can use a tweak, but overall is a pretty nice project.
I while back i was trying to come up with interesting rules to generate fractals and em up creating a genetic algorithm with you as the evaluator.
https://github.com/victorqribeiro/randomFractal
I while back i was trying to come up with interesting rules to generate fractals and em up creating a genetic algorithm with you as the evaluator.
https://github.com/victorqribeiro/randomFractal
[1] https://observablehq.com/@kelleyvanevert/l-systems-2