{-|
Module      : Graphics.OscPacking.Geometry
Description : Geometry helper functions and data types
Copyright   : (c) Christopher Howard, 2016
License     : GPL-3
Maintainer  : ch.howard@zoho.com
-}

module Graphics.OscPacking.Geometry where

import Prelude ((-), (**), (+), sqrt, Float)

data Circle = Circle {
  position :: Point,
  radius :: Float
  }

type Point = (Float, Float)
type Metric = Point -> Point -> Float

euclidean :: Metric
euclidean (x1, y1) (x2, y2) = sqrt ((x2 - x1)**2 + (y2 - y1)**2)

distToCircle :: Point -> Circle -> Float
distToCircle point circle = euclidean point (position circle) - radius circle