geodetic-0.1.1: Geodetic calculations

Safe HaskellNone

Data.Geo.Geodetic.Azimuth

Description

An azimuth in degrees between 0 and 360.

Synopsis

Documentation

data Azimuth Source

Instances

Eq Azimuth 
Ord Azimuth 
Show Azimuth

A show instance that prints to 4 decimal places. This is to take floating-point rounding errors into account.

HasAzimuth Azimuth 

class HasAzimuth t whereSource

Instances

modAzimuth :: Double -> AzimuthSource

Construct an azimuth such that if the given value is out of bounds, a modulus is taken to keep it within 0 inclusive and 360 exclusive.

>>> modAzimuth 7
Azimuth 7.0000
>>> modAzimuth 0
Azimuth 0.0000
>>> modAzimuth 360
Azimuth 0.0000
>>> modAzimuth 361
Azimuth 1.0000
>>> modAzimuth 359.999
Azimuth 359.9990

nAzimuth :: Prism' Double AzimuthSource

A prism on azimuth to an integer between 0 and 359 inclusive.

>>> 7 ^? nAzimuth
Just (Azimuth 7.0000)
>>> 0 ^? nAzimuth
Just (Azimuth 0.0000)
>>> 359.999 ^? nAzimuth
Just (Azimuth 359.9990)
>>> 360 ^? nAzimuth
Nothing
all (\m -> nAzimuth # m == n) (n ^? nAzimuth)