Skip to content

Instantly share code, notes, and snippets.

@gumik
gumik / ifs.hs
Created June 14, 2012 15:14
Haskell IFS (Iterated Funcion System) image generator
import System.Random
import Graphics.Rendering.Cairo
data IfsFunction a = IfsFunction a a a a a a a deriving Show
type Ifs a = [IfsFunction a]
calcIfs (IfsFunction a b c d e f _) (x, y) = (a*x + b*y + c, d*x + e*y + f)
-- Calculates [p1, p1 + p2, p1 + p2 + p3, ..., p1 + ... + pn] list
-- of give Ifs, where p_i is i'th function probability.