Questions tagged [l-systems]

A Lindenmayer System (l-system) is a way of representing growth processes, most commonly associated with plant development and fractals.

An L-system works off of the principal of recursive application of some production rules to a given axiom.

For example, given some axiom:

ω = "ABCDEFG"

And the production rules:

P = {p(1),p(2),p(3)}

p(1) : "A" -> "CA"
p(2) : "B" -> "BH"
p(3) : "F" -> "XYF" 

Applying the production rules to the axiom for 3 iterations would give the following output:

i = 1 : ω = "CABHCDEXYFG"
i = 2 : ω = "CCABHHCDEXYXYFG"
i = 3 : ω = "CCCABHHHCDEXYXYXYFG"

After generating the L-system output, the string is sent to a geometry generator, Turtle geometry being one of the most commonly used. The turtle geometry parses the string and according to each individual symbol in the string will perform some maneuvers in the Cartesian coordinate space it occupies.

For example, the turtle may turn left/right, pitch up/down, roll left/right, and move forward or backwards. The turtle often incorporates symbols to save it's current state to a stack in order to return to its previous positions.

The Wikipedia article describes the systems for 1-D Algae population growth, Pythagoras Tree, Cantor Dust, Koch Curve, Sierpinski Triangle, Dragon Curve, and a simple Fractal Plant.

The classic text, The Algorithmic Beauty of Plants by Lindenmayer and Prusinkiewicz is available here along with many, many related papers all of which are copiously and beautifully illustrated.

61 questions
2
votes
1 answer

Simple L -system in python

Hello I'm looking for a way to implement a simple L-system into function in python which would take three arguments : axiom , rules and number of interations(if iterations = 0 output would be previously input axiom). I came up with some code it only…
Piotrek Wcisło
  • 85
  • 1
  • 10
2
votes
0 answers

Neural network train on L-System output?

I'm trying to train a discriminator on L-system outputs. They have the form of a string like "F[/F]FF" with a limited vocabulary of symbols (9 symbols F0[]tTpP/) I have a bunch of output / bool couple as data (the l system output string, and weither…
Ragekit
  • 41
  • 2
2
votes
0 answers

Lsystem 3d Trees, more realism

I try to implement procedural 3d trees in OpenGL using Lsystem. Up to now I can get these kind of results: It looks like a tree, but I would like to improve the result, and get more realistic tree. Somebody have any ideas to simply add thickness…
JimZer
  • 918
  • 2
  • 9
  • 19
2
votes
1 answer

how to apply L-system logic to segments

Edit Here's a new version which correctly applies the length and model but doesn't position the model correctly. I figured it might help. http://codepen.io/pixelass/pen/78f9e97579f99dc4ae0473e33cae27d5?editors=001 I have 2 canvas…
user950658
2
votes
0 answers

Connecting Pvector points into a Mesh in Processing from an L-System?

I've built this L-System in Processing using toxiclib and I want to connect each point which is specified to each intersection in the branching of the tree. I've written a separate sketch in which I'm trying to create a triangle mesh by connecting…
Ceramicwhite
  • 57
  • 1
  • 6
2
votes
4 answers

Speeding up an L-System renderer in C#/WPF

lsys is a blazing fast L-System renderer written in CoffeeScript. Below is a simple renderer in C# and WPF. It is hardcoded to render this example. The result when run looks as follows: A mouse-click in the window will adjust the angleGrowth…
dharmatech
  • 8,979
  • 8
  • 42
  • 88
2
votes
1 answer

How to make turtle remember its position in L-systems?

We've just started programming at uni. One of our tasks is to create a fractal tree with the L-system with a turtle in python. This one: 1. variables : X F 2. constants : + − [ ] 3. start : X 4. rules : (X → F-[[X]+X]+F[+FX]-X), (F → FF) 5. angle …
Dbirkeland
  • 41
  • 2
  • 3
2
votes
2 answers

'iterator not dereferencable' C++ Stack

No idea what is going on here. I have a std stack of Vector3D's (a 3-dimensional vector class give to me by my tutor). I have pushed two Vector3D's on to the stack but when I go to go the top one with vectorStack.top() I am treated to this very…
BouncingCzech
  • 103
  • 1
  • 7
2
votes
1 answer

OpenGL L-System Rendering

I have gotten my basic L-System working and I decided to try and optimize the rendering of the application. Previously I was looping through the whole string of the L-System with a switch case and drawing. Better yet I will show you what I was…
Craig
  • 1,199
  • 1
  • 13
  • 27
1
vote
1 answer

L-System - Decrease cylinder radius for newer branches

I have a simple 3D L-System made from cylinders, and I currently just go through each symbol in the final string and do appropriate actions like draw, turn, rotate, push and pop. I am aware that push and pop pretty much resembles a new branch, but I…
Kachinsky
  • 573
  • 1
  • 7
  • 20
1
vote
0 answers

How do I add to the menu of this l-system

I need help figuring out how to add start and rules to the code. I'd like to be able to specify rules and type in a start function into the menu. I'm a math student and not really versed in js, but any help is appreciated! Here's the…
Operator
  • 19
  • 1
1
vote
1 answer

How should the ~ be interpreted for rewriting a module in the L-systems grammar from Algorithmic Beauty of Plants?

In The Algorithmic Beauty of Plants, there's an example parametric L-system (pg 69) showing the model of a flower crocus: I haven't been able to quite figure out how to interpret the ~ symbol in the production: p1: a(t) : t
heckj
  • 7,136
  • 3
  • 39
  • 50
1
vote
1 answer

Why is this postscript code not drawing anything?

%!PS-Adobe-3.0 EPSF-3.0 %%Title: L-System %%Creator: (me) %%BoundingBox: 0 0 500 500 %%EndComments % % %% BeginProlog ... %% EndProlog are document structuring comments % to give definitions of new "resources" (operators, fonts, etc.) % % %%…
BreezeWind
  • 618
  • 1
  • 9
  • 18
1
vote
1 answer

Why Isn't This L-System Code Returning a String?

I'm trying to write a program that takes a string and replaces certain characters with other strings. (A->AB) and (B->A) in this case. When I run it I expect the final string to be returned but instead nothing is returned. def…
Eli Rees
  • 178
  • 2
  • 14
1
vote
1 answer

Implementing a parametric L-system using python

I have been working on an implementation of a parametric L-system with python. My case is a 2D tree therefore i am using python turtle library. I wrote this simple code for a non-parametric L-system which it works pretty good. Here is my…
shahriar
  • 362
  • 4
  • 17