Plotting with Pen. After Flake - "The Computational Beauty of Nature".
lsystem |
An instance of RedLSystem or a String. |
length |
Line segment length in pixels. |
theta |
Angle in degrees. |
scale |
The amount to scale all moving commands ($F, $G, $|) in percent. |
noise |
The amount of uniform noise to add to all angles in radians. |
Start drawing the l-system or string at current Pen position.
Return a dictionary of default (character : function) pairs.
$F | draw forward |
$G | go forward |
$+ | turn right by theta |
$- | turn left by theta |
$[ | push state |
$] | pop state |
$| | draw forward scaled by depth |
An Integer before each character repeats that command n times.
Make up new rules by putting a character : function pair into command dictionary. Arguments passed in to function: depth, depthLength, index.
Creates a Window and draw the l-system or string. Mainly for testing.
bounds |
A Rect. |
initAngle |
Sets the initial Pen rotation in radians. |
initTranslate |
Sets the initial Pen translation in percent. |
Either a RedLSystem or a String. For strings depth and thereby $| scaling is ignored. For l-systems (the preferred way) the depth is calculated ($| scaling by generation).
A dictionary of current commands.
A general Function that gets evaluated right before each command (character in the production array). Arguments passed in to function: depth, depthLength, index.