module Convex_hull where

--distance between two points
seg_length a b = (x2-x1)^2 + (y2-y1)^2
                    where (x1,y1) = a
                          (x2,y2) = b

--distance from point c to line (a,b)
line_dist a b c = abs n / seg_length a b
                    where (x0,y0) = c
                          (x1,y1) = a
                          (x2,y2) = b
                          n = (y2-y1)*x0 - (x2-x1)*y0 + x2*y1 - x1*y2

data Side = Left|Right

--determines to which side of the line (a,b) point c is situated
--which_side a b c