<p>L-systems, are more about general : <a href="http://en.wikipedia.org/wiki/Abstract_rewriting_system">Abstract rewriting systems</a> rather then to concrete application.</p>

<p>Agree, a wide range of L-systems applications is in computer graphics (generating nature, textures etc), while from mathematical point of view, they are still, the same model.</p>

<p>As stated in referred by you <a href="http://en.wikipedia.org/wiki/L-system">L-systems definition</a> :</p>

<blockquote>
  <p>Using L-systems for generating graphical images requires that the symbols in the model refer to elements of a drawing on the computer screen.</p>
</blockquote>

<p>Coming back to your question </p>

<blockquote>
  <p>Yet in (...) implementation, even where a symbol is not defined, it will still be rendered as a full length. The question is, why?</p>
</blockquote>

<p>Answer: Because that's the way, how those implementations' authors decided to map symbols into rendering commands.</p>

<p>You can do in your implementation any other mapping... and still both of them can be same type of system - L-system.</p>

<p>It's all about defining <a href="http://en.wikipedia.org/wiki/Isomorphism">isomorphism</a> between systems behind implementations, or <a href="http://en.wikipedia.org/wiki/Homomorphism">homomorphism</a> between those systems and graphics they generate. If you will make your own implementation, that will draw symbols differently - you will indirectly define your own homomorphism.</p>

CC BY-SA 3.0
2011-09-06T17:24:43.757Z
2011-09-06T17:24:43.757Z
Grzegorz Wierzowiecki
<p>Am looking into writing up a <a href="http://en.wikipedia.org/wiki/L-system" rel="nofollow noreferrer">Lindenmayer systems</a> implementation. I've looked at a few example implementations and the one thing that's giving me trouble at this stage is how symbols and substitutions are <em>meant</em> to work (if this is even specified in the original treatise).</p>

<p>For example, the implementations I've seen tend in most cases to start with axioms based on A. Let's take the simplest example of this where the Axiom is (just) A.</p>

<p>When this is drawn (depth 0), what should I expect to see? If otherwise undefined, is A meant to render as anything at all? Or does it need to be defined as one full length (whichever symbol is used for this; I have seen pipe being used to this purpose) before it will render out?</p>

<p>Taking a second example, let us say that A renders out, irrespective of what the answer to the above is. If part of F's definition is B, and B is not defined, should B render as a full length?</p>

<p>The way I would expect this to work is that without F being defined at all, nothing should be drawn at depth 0 and subsequently at no other depth, either.</p>

<p>Yet in <a href="https://gamedev.stackexchange.com/questions/16817/2d-procedural-terrain-generation-guaranteeing-connectedness/16854#16854">L-systems Explorer (LSE)</a> and in <a href="http://lsysjs.qwert.ch/" rel="nofollow noreferrer">this</a> web-based implementation, even where a symbol is not defined, it will still be rendered as a full length. The question is, why?</p>

CC BY-SA 3.0
2011-09-06T10:45:29.260Z
I don't understand your question. Can you try to be more precise? What is "renders out"? What is F? What is full length? An L-System is specified as a triple $(V,\omega,P)$, where $V$ is the alphabet, $\omega$ is the initial string (or axiom), and $P$ is the production rules. I can guess $V$ and $\omega$ from your questions, but without you explicitly stating your production rules $P$ the system is unspecified.
Artem Kaznatcheev
CC BY-SA 3.0
2011-09-06T16:38:49.993Z
At depth 0 (iteration 0) the Axiom is rendered. At depth 1 (iteration 1), axiom is expanded and the resulting "tree" (string) is rendered. Each variable of the string is usually rendered with a fixed length straight line. Its origin and angle obviously depends on its "position/nesting" in the rendered string and the convetion used for constants. For example [+X] usually means render X as a right branch starting from the current position. I think Wikipedia is clear enough: http://en.wikipedia.org/wiki/L-system
Marzio De Biasi
<pl.programming-languages><grammars><term-rewriting-systems>
Lengths and substitution in L-systems
Engineer
# Lengths and substitution in L-systems

(Asked by: username_0 on 2011-09-06)

Am looking into writing up a [Lindenmayer systems](http://en.wikipedia.org/wiki/L-system) implementation. I've looked at a few example implementations and the one thing that's giving me trouble at this stage is how symbols and substitutions are *meant* to work (if this is even specified in the original treatise).

For example, the implementations I've seen tend in most cases to start with axioms based on A. Let's take the simplest example of this where the Axiom is (just) A.

When this is drawn (depth 0), what should I expect to see? If otherwise undefined, is A meant to render as anything at all? Or does it need to be defined as one full length (whichever symbol is used for this; I have seen pipe being used to this purpose) before it will render out?

Taking a second example, let us say that A renders out, irrespective of what the answer to the above is. If part of F's definition is B, and B is not defined, should B render as a full length?

The way I would expect this to work is that without F being defined at all, nothing should be drawn at depth 0 and subsequently at no other depth, either.

Yet in [L-systems Explorer (LSE)](https://gamedev.stackexchange.com/questions/16817/2d-procedural-terrain-generation-guaranteeing-connectedness/16854#16854) and in [this](http://lsysjs.qwert.ch/) web-based implementation, even where a symbol is not defined, it will still be rendered as a full length. The question is, why?

**Tags:** pl.programming-languages, grammars, term-rewriting-systems
> **Comments:**
> **username_1**: I don't understand your question. Can you try to be more precise? What is "renders out"? What is F? What is full length? An L-System is specified as a triple $(V,\omega,P)$, where $V$ is the alphabet, $\omega$ is the initial string (or axiom), and $P$ is the production rules. I can guess $V$ and $\omega$ from your questions, but without you explicitly stating your production rules $P$ the system is unspecified.  
> **username_2**: At depth 0 (iteration 0) the Axiom is rendered. At depth 1 (iteration 1), axiom is expanded and the resulting "tree" (string) is rendered. Each variable of the string is usually rendered with a fixed length straight line. Its origin and angle obviously depends on its "position/nesting" in the rendered string and the convetion used for constants. For example [+X] usually means render X as a right branch starting from the current position. I think Wikipedia is clear enough: http://en.wikipedia.org/wiki/L-system  

---

## 1 answers

### Answer by username_3 on 2011-09-06. Score: 7 | Accepted answer

L-systems, are more about general : [Abstract rewriting systems](http://en.wikipedia.org/wiki/Abstract_rewriting_system) rather then to concrete application.

Agree, a wide range of L-systems applications is in computer graphics (generating nature, textures etc), while from mathematical point of view, they are still, the same model.

As stated in referred by you [L-systems definition](http://en.wikipedia.org/wiki/L-system) :

> Using L-systems for generating graphical images requires that the symbols in the model refer to elements of a drawing on the computer screen.

Coming back to your question

> Yet in (...) implementation, even where a symbol is not defined, it will still be rendered as a full length. The question is, why?

Answer: Because that's the way, how those implementations' authors decided to map symbols into rendering commands.

You can do in your implementation any other mapping... and still both of them can be same type of system - L-system.

It's all about defining [isomorphism](http://en.wikipedia.org/wiki/Isomorphism) between systems behind implementations, or [homomorphism](http://en.wikipedia.org/wiki/Homomorphism) between those systems and graphics they generate. If you will make your own implementation, that will draw symbols differently - you will indirectly define your own homomorphism.


---

