-- | A geodetic curve is made of a distance in metres, an azimuth and a reverse azimuth.
module Data.Geo.GeodeticCurve(
                               GeodeticCurve,
                               geodeticCurve
                             ) where

import Data.Geo.Azimuth
import Data.Geo.Accessor.EllipsoidalDistance
import Data.Geo.Accessor.Azi
import Data.Geo.Accessor.ReverseAzi

data GeodeticCurve = GeodeticCurve Double Azimuth Azimuth
  deriving (Eq, Show)

-- | Construct a geodetic curve with the given parameters.
geodeticCurve :: Double -- ^ The ellipsoidal distance.
                 -> Azimuth -- ^ The azimuth.
                 -> Azimuth -- ^ The reverse azimuth.
                 -> GeodeticCurve
geodeticCurve = GeodeticCurve . abs

instance EllipsoidalDistance GeodeticCurve where
  ellipsoidalDistance (GeodeticCurve x _ _) = x

instance Azi GeodeticCurve where
  azi (GeodeticCurve _ x _) = x

instance ReverseAzi GeodeticCurve where
  reverseAzi (GeodeticCurve _ _ x) = x