Geodetic-0.1: Data/Geo/Azimuth.hs
{-# LANGUAGE GeneralizedNewtypeDeriving, MultiParamTypeClasses #-}
-- | An azimuth in degrees between 0 and 360).
module Data.Geo.Azimuth(
Azimuth,
azimuth
) where
import Data.Fixed
import Data.Geo.Accessor.Value
newtype Azimuth = Azimuth Double
deriving (Eq, Ord, Enum, Show, Num, Fractional, Floating)
-- | Construct an azimuth with the number of degrees.
azimuth :: Double -> Azimuth
azimuth x = Azimuth (x `mod'` 360)
instance Value Azimuth Double where
value (Azimuth x) = x