L-Systems and Turtle Graphics
An L-System (or Lindenmayer System) is a mathematical and computational method that can generate complex behavior from very simple rules, usually used to simulate plants and fractal growth.
L-Systems are comprised of a collection of symbols, a subset of which is the initial "step" (axiom), and a series of rules that indicate how to recursively substitute these symbols for others once encountered.
For example, for an L-System comprised of symbols A and B, rules A = BA and B = A, and axiom A, the iterations produced would be as follows:
- ... etc.
These symbols do not need to be letters. For instance, they can be mapped into actions. Turtle Graphics is the interpretation of an L-System's output into graphics, by way of assigning different movements or commands to symbols in the L-System, that a "Turtle" or imaginary robot will implement. These commands allow the Turtle to do things like rotate, jump, or walk while drawing a line in the space, producing graphical results (or, in our case, printer movements).
As a simplified example, + could stand for "turn counterclockwise", - for "turn clockwise", F for "walk forward while drawing a line (or extruding material)", f for "jump forward without drawing a line", and so on, including turning commands for the two other axis if the Turtle is to navigate in 3D space. Symbols/commands can even be functions with their own inputs, such as the distance to be walked or the degrees to turn if they are not default.
In this way, many iterations of shape growth can be encoded in the small amount of data needed to store the L-System's rules and axiom.
For a complete explanation of L-Systems and Turtle Graphics, including other common Turtle Graphics commands, we recommend consulting the freely available book The Algorithmic Beauty of Plants, by Przemyslaw Prusinkiemicz and Aristid Lindenmayer.
L-Systems have been mostly used to generate 2D and 3D shapes that are not meant to be 3D printed.
We developed software (in the Processing programming language) and a workflow that are able to generate different L-Systems which, when interpreted through Turtle Graphics, produce self-sustaining shapes that do not collapse when 3D printed with clay. Unlike the usual 3D printing methods, the Turtle Graphics' output is not a 3D model to be later translated into machine code; the Turtle commands are directly translated into G-code commands, which is the language that most CNC machines (such as 3D printers) are controlled with.
The digital, weightless paths generated don't translate directly into the same shape upon being printed; they gain the additional depth of the clay's extrusion volume and gravity. We were constantly reminded that the Turtle paths don't codify for shapes, but for printer gestures interacting with the extruded material. We came up with ways in which to harness the expressiveness of these gestures, which one cannot see in the usual 3D printing processes, such as rapidly pulling upwards from the extruded material to "cut" it, forming spikes.
Turtle Graphics do not need to be fed an L-System's output, they can be used alone to encode printer movement by hand. This method allows for quite precise control over the printer (as opposed to the generative quality of an L-System's results) without being as difficult to program as G-code. Turtle Graphics encourage an intuitive, more body-involved way of thinking about 3D printing: encoding prints in terms of a dance sequence, instead of spatial coordinates.