An L-System engine and turtle-based renderer.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.6 KiB

SimpleTurtle L-System Renderer
by Starbeamrainbowlabs
Usage:
./SimpleTurtle.exe {options}
Options:
-i --input-file The file that contains the input L-System parameters. Defaults to stdin.
-o --output-dir The output directory in which to save the rendered / simulated L-System generations. Defaults to the name of the input file, minus the file extension - or just simply 'l-system'.
-s --skip-gen The starting generation. Default: 0.
-c --count The number of generations to render. Default: 5
-d --step-dist The number of pixels the turtle will walk forwards at a time. Default: 25.
Input File Format:
The first line is the seed (the starting state).
Subsequent lines beginning with a # (hash sign) are ignored.
Rules are declared with an equals sign - i.e. f=f-f+, or fb=fbfafcfafb.
Lines starting with an exclamation mark specify directives that should be passed to the turtle - i.e. !angle=1.0472
The L-System is rendered at each generation. Any character the turtle doesn't understand is ingored.
Turtle Characters:
f Move forwards
h Also move forwards
+ Turn clockwise
- Turn anti-clockwise
[ Save position & heading to stack
] Restore position & heading from stack
Turtle Directives:
angle Sets the angle by which the turtle should turn. Note that this is specified in radians.
Example Input Files:
Hilbert Curve:
-----
a
a=-bf+afa+fb-
b=+af-bfb-fa+
-----
Dragon Curve:
-----
f
f=f-h
h=f+h
-----
Sierpinski Triangle
-----
f
!angle=1.0472
h=f+h+f
f=h-f-h
-----