Tech News
← Back to articles

Lindenmayer.jl: Defining recursive patterns in Julia

read original related products more articles

This is a simple package that can make LSystems. It uses Luxor.jl to draw them.

An LSystem, or Lindenmayer system, is a set of rules that can define recursive patterns.

These were introduced and developed in 1968 by Aristid Lindenmayer, a Hungarian theoretical biologist and botanist at the University of Utrecht. Lindenmayer used LSystems to describe the behaviour of plant cells and to model the growth processes of plant development. LSystems have also been used to model the morphology of a variety of organisms and can be used to generate self-similar fractals such as iterated function systems.

In Lindenmayer.jl you can define an LSystem like this:

sierpinski_triangle = LSystem([ "F" => "G+F+Gt", "G" => "F-G-F"], "G")

This one has two rules, and an initial state. You can draw it using the drawLSystem() function.

For example:

using Lindenmayer sierpinski_triangle = LSystem([ "F" => "G+F+Gt", "G" => "7F-G-F" ], "G") drawLSystem(sierpinski_triangle, forward = 10, turn = 60, iterations = 6, startingx = -300, startingy = -300, filename = :svg)

In Lindenmayer.jl, an LSystem consists of:

Rules: one or more search and replace rules in a Vector . Each rule replaces a single-character string with a string of one or more characters

... continue reading