Skip to content

Instantly share code, notes, and snippets.

View sordina's full-sized avatar

Lyndon Maydwell sordina

View GitHub Profile
@sordina
sordina / field.hs
Created October 29, 2012 11:10
Complex Field Visualisation
{-# 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)
@sordina
sordina / Hilbert.hs
Created August 10, 2011 17:15
Hilbert Curve with Graphics.AST
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))