hls-0.11: Haskell Lindenmayer Systems

LSystem.LSystem

Description

Lindenmayer system definition, expander and renderer.

Synopsis

Documentation

type Element = CharSource

Element of Axiom.

type Axiom = [Element]Source

An axiom (sequence of Elements).

data LSystem Source

An LSystem is an Axiom and a set of Rules.

Constructors

LSystem Axiom Rules 

Instances

lSystem :: Axiom -> [(Element, [Element])] -> LSystemSource

L-System constructor.

 lSystem "F+F+F" [('F',"F-F+F")]

getRule :: Rules -> Element -> [Element]Source

Rule lookup.

applyRule :: [Element] -> Rules -> [Element]Source

Rule application.

expand :: LSystem -> Int -> [Element]Source

n iterations of the specified LSystem.

 expand (lSystem "F+F+F" [('F',"F-F+F")]) 1 == "F-F+F+F-F+F+F-F+F"

stateT :: Element -> Turtle -> TurtleSource

State transformer Turtle commands.

cmd :: (Turtle -> b -> (Turtle, b)) -> Element -> Turtle -> b -> (Turtle, b)Source

Operational Turtle commands.

render :: b -> (b -> Pt -> Pt -> b) -> [Element] -> Turtle -> bSource

Fold over an expanded L-system using standard turtle commands.