module Glilis: sig
.. end
Graphical primitives for drawing L-systems.
We use a logo-like system to draw a L-system : a turtle is following the order in the Lstream.
type
pos = {
|
mutable x : float ; |
|
mutable y : float ; |
|
mutable d : float ; |
}
type
color = {
|
r : float ; |
|
g : float ; |
|
b : float ; |
|
a : float ; |
}
type
orders =
| |
Forward |
| |
Forward' |
| |
Turn |
| |
Save |
| |
Restore |
| |
Color |
The type of orders always accepted by a turtle.
val orders : (string * (orders * int)) list
Mapping from string tokens to orders. Also contains the arity of the orders.
type 'a
turtle = {
|
get_pos : unit -> pos ; |
|
get_color : unit -> color ; |
|
turn : float -> unit ; |
|
move : ?trace:bool -> float -> unit ; |
|
save_position : unit -> unit ; |
|
restore_position : unit -> unit ; |
|
color : color -> unit ; |
|
handle_lsys : (unit -> unit) -> 'a ; |
}
Class representing a turtle.
val turtle : unit -> unit turtle
This turtle implements most movement calculations, without any actual drawing. See
LisCairo
and
LisTyxml
for use examples. See
Glilis.turtle
for methods documentation.
val transform_rhs : 'a turtle -> string -> ('c -> float) array -> 'c -> unit
Can be combined with Lilis.Engine.map_crules
to use Lilis.Engine.eval_iter_lsys
.
val transform_lsys : 'a turtle ->
(string * 'b) Lilis.lsystem ->
(('c -> float) array -> 'c -> unit) Lilis.lsystem
Can be feeded directly to Lilis.Engine.eval_iter_lsys
.