module TerraHS.Algebras.Base.Operations  where


class BinaryPredicates a b where
	intersects, contains, coveredby, overlaps, equals, within, disjoint, crosses, touches  :: a -> b -> Bool
	containedBy  :: b -> a -> Bool
	
	before		:: a -> b -> Bool
	after		:: a -> b -> Bool
	
	
	equals g1 g2  =  error "Not Applicable" 
	within g1 g2  = error "Not Applicable" 
	disjoint g1 g2  = error "Not Applicable" 
	touches g1 g2 =   error "Not Applicable" 
	overlaps g1 g2 =  error "Not Applicable" 
	coveredby g1 g2 = error "Not Applicable" 
	crosses g1 g2 =  error "Not Applicable" 
	contains g1 g2 = error "Not Applicable" 
	intersects g1 g2 = not (disjoint g1 g2)
	before g1 g2 = error "Not Applicable" 
	after g1 g2 = error "Not Applicable" 

---- Set Operations -----------------------------------------------------------


class Set a where
	union			:: a -> a -> a
	intersection 		:: a -> a -> a
	difference 		:: a -> a -> a
	

	
----------------- Distance and Direction Operations ------------------------------------------------

class DistanceDirection a where
	distance 	:: a -> a -> Double
	direction 	:: a -> a -> Double

	
----------------- Aggregation -------------------------------------
class Aggregation a b where
	avg 	:: a -> b

	
class Numeric a where
	length	:: a -> Double	
	area	:: a -> Double	
	
----- centroid

-- | Calculates the centroid of a object
class Centroid a b where
	centroid :: a -> b