Skip to content

Instantly share code, notes, and snippets.

@dmbfm
dmbfm / test
Created September 20, 2014 05:19
{- drawPoint : returns a pixel (size 2 square) Form
of color 'val' at position (x,y) -}
drawPoint : (Int,Int, Float) -> Form
drawPoint (x,y,val) =
square 2
|> filled (Color.greyscale (1-val))
|> move (toFloat x,toFloat y)
@dmbfm
dmbfm / test.elm
Created September 20, 2014 05:20
{- drawPoint : returns a pixel (size 2 square) Form
of color 'val' at position (x,y) -}
drawPoint : (Int,Int, Float) -> Form
drawPoint (x,y,val) =
square 2
|> filled (Color.greyscale (1-val))
|> move (toFloat x,toFloat y)
module Vector where
type Vec3 = (Float, Float, Float)
add : Vec3 -> Vec3 -> Vec3
add (x,y,z) (u,v,w) = (x+u,y+v,z+w)
mul : Float -> Vec3 -> Vec3
mul a (x,y,z) = (a*x,a*y,a*z)
module Vector where
type Vec3 = (Float, Float, Float)
add : Vec3 -> Vec3 -> Vec3
add (x,y,z) (u,v,w) = (x+u,y+v,z+w)
mul : Float -> Vec3 -> Vec3
mul a (x,y,z) = (a*x,a*y,a*z)
module Vector where
type Vec3 = (Float, Float, Float)
add : Vec3 -> Vec3 -> Vec3
add (x,y,z) (u,v,w) = (x+u,y+v,z+w)
mul : Float -> Vec3 -> Vec3
mul a (x,y,z) = (a*x,a*y,a*z)
module Vector where
type Vec3 = (Float, Float, Float)
i : Vec3
i = (1,0,0)
j : Vec3
j = (0,1,0)
k : Vec3
k = (0,0,1)
module Vector where
type Vec3 = (Float, Float, Float)
i : Vec3
i = (1,0,0)
j : Vec3
j = (0,1,0)
k : Vec3
k = (0,0,1)
1
2
3
4
5
6
7
8
9
module Vector where
type Vec3 = (Float, Float, Float)
add : Vec3 -> Vec3 -> Vec3
add (x,y,z) (u,v,w) = (x+u,y+v,z+w)
mul : Float -> Vec3 -> Vec3
mul a (x,y,z) = (a*x,a*y,a*z)
@dmbfm
dmbfm / main
Created September 26, 2014 16:29
---- Screen paremeters
width = 800
height = 600
---- main collage
main = collage width height (screen width height)