Initial commit
This commit is contained in:
commit
9c21bf1d37
10 changed files with 272 additions and 0 deletions
54
app/Examples.hs
Normal file
54
app/Examples.hs
Normal file
|
@ -0,0 +1,54 @@
|
|||
module Examples
|
||||
( gosper
|
||||
, hilbert
|
||||
, koch
|
||||
, sierpinski
|
||||
, sierpinskiArrow
|
||||
) where
|
||||
|
||||
import Lib
|
||||
|
||||
gosper :: LSystem Char
|
||||
gosper = LSystem
|
||||
"AB+-"
|
||||
"A"
|
||||
[ ('A', "A-B--B+A++AA+B-")
|
||||
, ('B', "+A-BB--B-A++A+B")]
|
||||
60
|
||||
10
|
||||
[('A',Forward), ('B',Forward), ('+',TurnRight), ('-',TurnLeft)]
|
||||
|
||||
hilbert = LSystem
|
||||
"ABF+-"
|
||||
"A"
|
||||
[ ('A', "-BF+AFA+FB-")
|
||||
, ('B', "+AF-BFB-FA+")]
|
||||
90
|
||||
10
|
||||
[('F',Forward), ('+',TurnRight), ('-',TurnLeft)]
|
||||
|
||||
koch = LSystem
|
||||
"F+-"
|
||||
"F"
|
||||
[('F', "F+F-F-F+F")]
|
||||
90
|
||||
10
|
||||
[('F',Forward), ('+',TurnRight), ('-',TurnLeft)]
|
||||
|
||||
sierpinski = LSystem
|
||||
"AB+-"
|
||||
"A-B-B"
|
||||
[ ('A', "A-B+A+B-A")
|
||||
, ('B', "BB")]
|
||||
120
|
||||
10
|
||||
[('A',Forward), ('B',Forward), ('+',TurnRight), ('-',TurnLeft)]
|
||||
|
||||
sierpinskiArrow = LSystem
|
||||
"AB+-"
|
||||
"A"
|
||||
[ ('A', "B+A+B")
|
||||
, ('B', "A-B-A")]
|
||||
60
|
||||
10
|
||||
[('A',Forward), ('B',Forward), ('+',TurnRight), ('-',TurnLeft)]
|
11
app/Main.hs
Normal file
11
app/Main.hs
Normal file
|
@ -0,0 +1,11 @@
|
|||
module Main where
|
||||
|
||||
import Graphics.Gloss
|
||||
|
||||
import Lib
|
||||
import Examples
|
||||
|
||||
main :: IO ()
|
||||
main =
|
||||
display (InWindow "L-System" (200, 200) (10, 10)) black (color white pic)
|
||||
where pic = drawLSystem $ iterateLSystem 5 gosper
|
Loading…
Add table
Add a link
Reference in a new issue