Created
January 16, 2017 13:53
-
-
Save wizzup/fd380a93c2fb92ad3eb4483d6f17bcab to your computer and use it in GitHub Desktop.
diagrams testing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Diagrams.Prelude | |
import Diagrams.Backend.SVG.CmdLine | |
import Control.Monad | |
points :: [P2 Double] | |
points = map (\[a,b] -> p2 (a,b)) $ replicateM 2 ([1,10..100] :: [Double]) | |
myC :: Int -> Diagram B | |
myC r = square (fromIntegral r) #lc color #lw 3 | |
where color = case r `mod` 3 of | |
0 -> red | |
1 -> green | |
2 -> blue | |
myCC :: Int -> Diagram B | |
myCC 0 = mempty | |
myCC n = myC n # rotateBy (1 / fromIntegral n) <> myCC (n-1) | |
myD :: Diagram B | |
myD = atPoints points (repeat $ myCC 10) | |
main = do | |
print points | |
defaultMain $ myD |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment