Haskell code for some basic computational geometry