L-System Generator

Python

L-System Generator

Co-developed with two others as our Formal Language and Finite Automata final project
------------------------
Programmed in python, connects to the 3d modelling software Blender to procedurally generate a "tree" using an L-System input

L-System Input Explanation

Techincal explanation for Tree creation:
Rotation Matrices:
RU(α) = [ (cos α, sin α, 0),
(− sin α, cos α, 0),
(0, 0, 1)]

RL(α) = [ (cos α 0 − sin α)
(0 1 0)
(sin α 0 cos α)]

RH(α) = [ (1 0 0)
(0 cos α − sin α)
(0 sin α cos α)]

The following symbols control turtle orientation in space:
+ Turn left by angle δ, using rotation matrix RU(δ).
− Turn right by angle δ, using rotation matrix RU(−δ).
* Pitch down by angle δ, using rotation matrix RL(δ).
/ Pitch up by angle δ, using rotation matrix RL(−δ).
^ Roll left by angle δ, using rotation matrix RH(δ).
! Roll right by angle δ, using rotation matrix RH(−δ).

[ Open Branch
] Close Branch

Built in Demo tree uses the input:
F[+F]/F[-F]*F^F!F[+F[+F]/F[-F]*F^F!F]/F[+F]/F[-F]*F^F!F[-F[+F]/F[-F]*F^F!F]*F^F!F[+F]/F[-F]*F^F!F[+F[+F]/F[-F]*F^F!F]/F[+F]/F[-F]*F^F!F[-F[+F]/F[-F]*F^F!F]*F^F!F[-F[+F]/F[-F]*F^F!F]/F[+F]/F[-F]*F^F!F[+F[+F]/F[-F]*F^F!F]/F[+F]/F[-F]*F^F!F[-F[+F]/F[-F]*F^F!F]*F^

Examples

Download and Run Instructions

The Visual Studio Code extension "Blender Development" by Jacques Lucke is required to properly connect the program to Blender

Open the folder titled Module in VS Code and open "inputbox.py", Press Ctrl+Shift+P and run "Blender: Start" pick your version of Blender to open

Open the given demo tree in L-SystemDemo.blend or create your own

press Ctrl+Shift+P again and run "Blender: Run Script"

Follow the images to open the L-System interaction screen, Either clear the current tree or input your own L-System to generate a fresh tree!

Download

Github Link