This is an old revision of the document!
Sistemele Lindenmayer (L-Systems) sunt un model matematic introdus de biologul Aristid Lindenmayer în 1968 pentru a modela procesele de creștere ale plantelor. Acestea sunt deosebit de eficiente pentru simularea structurilor și fractalilor asemănătoare plantelor.
Componentele ale sistemelor L:
Exemple de structuri care imită plantele se pot vedea în imaginea de mai jos:
În exemplul de mai sus, se folosește interpretarea “turtle” a stringurilor. Astfel, se întâlnesc următoarele simboluri:
O variantă în care se poate implementa ușor un L-System este folosind biblioteca turtle din Python. Astfel, pentru a inițializa biblioteca, se folosește următoarea secvență de cod:
# Initialize turtle t = turtle.Turtle() wn = turtle.Screen() t.speed(0) t.left(90) t.penup() t.goto(0, -wn.window_height() // 2 + 20) t.pendown() # TODO Your implementation goes here # Wait for user to close window wn.mainloop()
Funcții utile în implementarea unui sistem L, folosind turtle:
t.forward(distance) # Move forward t.goto(position) # Move to position, without drawing anything t.left(angle) # Turn left t.right(angle) # Turn right t.setheading(heading) # Set the rotation angle t.penup() # Stop drawing t.pendown() # Start drawing