artificial life

Chapter 4: Lindenmayer Systems

4.4 3D L-Systems (Direct3D)

A 3D L-Systems application is also implemented for this project. The application makes use of Microsoft’s Direct3D API. The conventional L-System cursor is changed to be used in the 3D-space. Instead of drawing a line when it encounters an’F’ the 3D cursor will draw a cylinder of length one. Since there are 3 different axes of rotation the grammar is expanded to use the characters {X,x,Y,y,Z,z} to indicate the axis and direction of a rotation.


Screenshot from 3D L-Systems Application

Screenshot from 3D L-Systems Application


The user is able to rotate the L-System around using a mouse, zooming is possible using a mouse wheel. Definition of the L-System is possible using a dialog box accessible from the menu.


3D L-System Definition Dialog

Figure 4.6: 3D L-System Definition Dialog


Initial String: The initial string that the L-System uses.

# of Iterations: The number of times the L-System will regenerate itself.

Angle: The angle by which {x,X,y,Y,z,Z} will rotate the cursor in their respective axes.

Rules: The grammar that the L-System will use to create the final object.



Windows Executable of 3D L-Systems:

3DLSystems.zip


Source Code for 3D L-Systems Application:

cursor.h

cursor.cpp

cursorStack.h

cursorStack.cpp

LSystem.h

LSystem.cpp

resource.h

LSys.rc

main.cpp