-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell Lindenmayer Systems -- -- Haskell library for generating Lindemayer systems @package hls @version 0.11 -- | Standard Turtle graphics. module LSystem.Turtle -- | Turtle. data Turtle Turtle :: Double -> Double -> Pt -> Double -> Double -> Double -> [Turtle] -> Turtle -- | turning angle ta :: Turtle -> Double -- | turning angle increment tai :: Turtle -> Double -- | location loc :: Turtle -> Pt -- | heading hdg :: Turtle -> Double -- | line length ll :: Turtle -> Double -- | length scalar ls :: Turtle -> Double -- | turtle stack stk :: Turtle -> [Turtle] -- | Right turn by ta. turnRight :: Turtle -> Turtle -- | Left turn by ta. turnLeft :: Turtle -> Turtle -- | 180 degree turn. turnBack :: Turtle -> Turtle -- | Increment line length (ll) by multiplying by line scalar -- (ls). incrLine :: Turtle -> Turtle -- | Decrement line length (ll) by dividing by line scalar -- (ls). decrLine :: Turtle -> Turtle -- | Move loc of Turtle by ll on current hdg. forward :: Turtle -> Turtle -- | Push Turtle onto stk. push :: Turtle -> Turtle -- | Fetch Turtle from stk. pop :: Turtle -> Turtle -- | Given state processing function f, a Turtle and an -- initial state, step Turtle and state. stepTurtle :: (t -> Pt -> Pt -> b) -> Turtle -> t -> (Turtle, b) -- | Lindenmayer system definition, expander and renderer. module LSystem.LSystem -- | Element of Axiom. type Element = Char -- | An axiom (sequence of Elements). type Axiom = [Element] -- | A Map from Elements to Axioms. type Rules = Map Element Axiom -- | An LSystem is an Axiom and a set of Rules. data LSystem LSystem :: Axiom -> Rules -> LSystem -- | L-System constructor. -- --
-- lSystem "F+F+F" [('F',"F-F+F")]
--
lSystem :: Axiom -> [(Element, [Element])] -> LSystem
-- | Rule lookup.
getRule :: Rules -> Element -> [Element]
-- | Rule application.
applyRule :: [Element] -> Rules -> [Element]
-- | 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"
--
expand :: LSystem -> Int -> [Element]
-- | State transformer Turtle commands.
stateT :: Element -> Turtle -> Turtle
-- | Operational Turtle commands.
cmd :: (Turtle -> b -> (Turtle, b)) -> Element -> Turtle -> b -> (Turtle, b)
-- | Fold over an expanded L-system using standard turtle commands.
render :: b -> (b -> Pt -> Pt -> b) -> [Element] -> Turtle -> b
instance Eq LSystem
instance Show LSystem
-- | Postscript renderer for LSystems.
module LSystem.Render.PS
-- | Given initial ta, ls and ll values render
-- i steps of an LSystem.
renderL :: (LSystem, Double, Double) -> Int -> Double -> [(Pt, Pt)]
-- | Given a scalar and a Path render a greyGS Image.
draw :: Double -> Path -> Image
-- | Rendering functions for grounded (ie. with ta and ls
-- values) LSystems.
renderLL, renderLO :: (LSystem, Double, Double) -> Int -> Double -> Path
-- | Various LSystems. For l0 through lB see
-- http://paulbourke.net/fractals/lsys/. For lC see
-- http://en.wikipedia.org/wiki/Penrose_tiling. For lD see
-- http://hackage.haskell.org/package/nymphaea.
module LSystem.Systems
l0, lB, lA, l9, l8, l7, l6, l5, l4, l3, l2, l1 :: LSystem
lC :: LSystem
lD :: LSystem
l0d, lDd, lCd, lBd, lAd, l9d, l8d, l7d, l6d, l5d, l4d, l3d, l2d, l1d :: (LSystem, Double, Double)
l0i, lDi, lCi, lBi, lAi, l9i, l8i, l7i, l6i, l5i, l4i, l3i, l2i, l1i :: Image
-- | Generate postscript file with drawings of l0 through lD.
--
-- -- systems_ps "/tmp/hls.ps" -- System.Process.system "gv /tmp/hls.ps" --systems_ps :: FilePath -> IO ()