{--
   Points
   
   author:        Sergio Costa
   date:          março 2006
    
   version:       1.0
   history:       
--}

-- | Module for handling the points
module Algebras.Base.Points
	(
		-- * The @Points@ class
		Points (..)
	)
	 where

import TerraHS.TerraLib.TePoint	 

class (Num a) => Points p a | p -> a where
	-- | Create a point from two coordinates
	createPoint :: a -> a -> p 
	
	-- | Returns the X componente of the coordinate 
	getX :: p  -> a
	
	-- | Returns the Y componente of the coordinate 
	getY :: p  -> a

	-- |  Check if the two coordinates are equal
	equal :: p -> p -> Bool
	equal a b = (getX a == getX b) && (getY a == getY b)
	
	
instance Points TePoint Double where
	createPoint cx cy = (TePoint (cx, cy) )
	getX (TePoint (cx, cy)) = cx
	getY (TePoint (cx, cy)) = cy