Class LSystem
java.lang.Object
org.episteme.natural.biology.lsystems.LSystem
Lindenmayer System (L-System) for generating fractal and plant-like
structures.
L-systems are parallel rewriting systems used to model the growth of plants and other biological structures. They consist of:
- Alphabet - set of symbols
- Axiom - initial state
- Production rules - symbol replacement rules
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Constructor Details
-
LSystem
Creates a new L-System.- Parameters:
axiom- the initial stringangle- the turning angle in degrees
-
-
Method Details
-
addRule
-
generate
Generates the L-system string after n iterations.- Parameters:
iterations- number of iterations- Returns:
- the generated string
-
getAxiom
-
getAngle
public double getAngle() -
getRules
-
interpret
Interprets the L-system string as turtle graphics commands.Standard symbols:
- F - move forward and draw
- f - move forward without drawing
- + - turn left by angle (Yaw)
- - - turn right by angle (Yaw)
- invalid input: '&' - pitch down by angle
- ^ - pitch up by angle
- / - roll right by angle
- \ - roll left by angle
- | - turn around (180 degrees)
- [ - push state (position, orientation)
- ] - pop state
-