Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
13
Task/Sierpinski-pentagon/Haskell/sierpinski-pentagon-1.hs
Normal file
13
Task/Sierpinski-pentagon/Haskell/sierpinski-pentagon-1.hs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
import Graphics.Gloss
|
||||
|
||||
pentaflake :: Int -> Picture
|
||||
pentaflake order = iterate transformation pentagon !! order
|
||||
where
|
||||
transformation = Scale s s . foldMap copy [0,72..288]
|
||||
copy a = Rotate a . Translate 0 x
|
||||
pentagon = Polygon [ (sin a, cos a) | a <- [0,2*pi/5..2*pi] ]
|
||||
x = 2*cos(pi/5)
|
||||
s = 1/(1+x)
|
||||
|
||||
main = display dc white (Color blue $ Scale 300 300 $ pentaflake 5)
|
||||
where dc = InWindow "Pentaflake" (400, 400) (0, 0)
|
||||
|
|
@ -0,0 +1 @@
|
|||
transformation = Scale s s . (Rotate 36 <> foldMap copy [0,72..288])
|
||||
Loading…
Add table
Add a link
Reference in a new issue