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
{-# LANGUAGE BangPatterns #-} | |
-- Preview on Youtube: http://www.youtube.com/watch?v=bK01Bgh32Sc | |
import Data.Complex | |
type C = Complex Float | |
type Color = (Float,Float,Float) | |
type Point = (Float,Float) |
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.AST | |
main = outputImage "hilbert.png" w w (hilbert i) where (i,w) = (8,1200) | |
hilbert i = Modifier (LineWidth 0.1) $ Shape $ Path Open $ Offsets (iterate build base !! i) | |
base = [(0,1),(1,0),(0,-1)] | |
build x = l $ n x ++ o ++ r (r (l (x ++ o ++ x) ++ o ++ n x)) |