Hasty Briefsbeta

Bilingual

Lindenmayer.jl: Defining recursive patterns in Julia

8 days ago
  • #Julia
  • #Fractals
  • #LSystems
  • Lindenmayer.jl is a package for creating LSystems, which are recursive patterns defined by rules.
  • LSystems were developed by Aristid Lindenmayer in 1968 to model plant growth and organism morphology.
  • The package uses Luxor.jl for drawing the LSystems.
  • An LSystem consists of rules (search and replace), an initial state, and a current state.
  • Example: Sierpinski triangle LSystem with rules 'F' => 'G+F+Gt' and 'G' => 'F-G-F'.
  • The drawLSystem() function evaluates and draws the LSystem with customizable parameters like forward distance and turn angle.
  • Characters in rules correspond to turtle commands (e.g., 'F' for forward, '+' for clockwise turn).
  • Additional features include arbitrary functions via the '*' character and custom evaluations using evaluate() and render().
  • Debugging can be enabled with ENV['JULIA_DEBUG'] = Lindenmayer.