Add Penrose P3 tiling

This commit is contained in:
Dimitri Lozeve 2018-01-17 11:09:11 +00:00
parent 05feb56763
commit 76a579c981
2 changed files with 18 additions and 1 deletions

View file

@ -8,4 +8,4 @@ import Examples
main :: IO () main :: IO ()
main = main =
display (InWindow "L-System" (200, 200) (10, 10)) black (color white pic) display (InWindow "L-System" (200, 200) (10, 10)) black (color white pic)
where pic = drawLSystem $ iterateLSystem 7 plant where pic = drawLSystem $ iterateLSystem 6 penroseP3

View file

@ -11,6 +11,8 @@ module Examples
, dragon , dragon
, tree , tree
, plant , plant
-- * Tilings
, penroseP3
) where ) where
import Lib import Lib
@ -112,3 +114,18 @@ plant = LSystem
25 25
1 1
[('F',Forward), ('+',TurnRight), ('-',TurnLeft), ('[',Push), (']',Pop)] [('F',Forward), ('+',TurnRight), ('-',TurnLeft), ('[',Push), (']',Pop)]
-- | Penrose P3
penroseP3 =
LSystem
"MNOPA+-[]"
"[N]++[N]++[N]++[N]++[N]"
[('M',"OA++PA----NA[-OA----MA]++")
,('N',"+OA--PA[---MA--NA]+")
,('O',"-MA++NA[+++OA++PA]-")
,('P',"--OA++++MA[+PA++++NA]--NA")
,('A',"")]
36
10
[('M',Forward), ('N',Forward), ('O',Forward), ('P',Forward), ('A',Forward),
('+',TurnRight), ('-',TurnLeft), ('[',Push), (']',Pop)]