jord-2.0.0.0: Geographical Position Calculations

Copyright(c) 2020 Cedric Liegeois
LicenseBSD3
MaintainerCedric Liegeois <ofmooseandmen@yahoo.fr>
Stabilityexperimental
Portabilityportable
Safe HaskellSafe
LanguageHaskell2010

Data.Geo.Jord.Angle

Contents

Description

Types and functions for working with angles representing latitudes, longitude and bearings.

In order to use this module you should start with the following imports:

import Data.Geo.Jord.Angle (Angle)
import qualified Data.Geo.Jord.Angle as Angle
Synopsis

The Angle type

data Angle Source #

An angle with a resolution of a microarcsecond. When used as a latitude/longitude this roughly translate to a precision of 0.03 millimetres at the equator.

Instances
Eq Angle Source # 
Instance details

Defined in Data.Geo.Jord.Angle

Methods

(==) :: Angle -> Angle -> Bool #

(/=) :: Angle -> Angle -> Bool #

Ord Angle Source # 
Instance details

Defined in Data.Geo.Jord.Angle

Methods

compare :: Angle -> Angle -> Ordering #

(<) :: Angle -> Angle -> Bool #

(<=) :: Angle -> Angle -> Bool #

(>) :: Angle -> Angle -> Bool #

(>=) :: Angle -> Angle -> Bool #

max :: Angle -> Angle -> Angle #

min :: Angle -> Angle -> Angle #

Read Angle Source #

See angle.

Instance details

Defined in Data.Geo.Jord.Angle

Show Angle Source #

Show Angle as degrees, minutes, seconds and milliseconds - e.g. 154°25'43.5".

Instance details

Defined in Data.Geo.Jord.Angle

Methods

showsPrec :: Int -> Angle -> ShowS #

show :: Angle -> String #

showList :: [Angle] -> ShowS #

Smart constructors

decimalDegrees :: Double -> Angle Source #

Angle from given decimal degrees. Any Double is accepted: it must be validated by the call site when representing a latitude or longitude.

dms :: Int -> Int -> Double -> Either String Angle Source #

Angle from the given degrees, arcminutes and decimal arcseconds. A Left indicates that given arcminutes and/or arcseconds are invalid.

radians :: Double -> Angle Source #

Angle from the given radians.

Calculations

arcLength :: Angle -> Length -> Length Source #

arcLength a r computes the Length of the arc that subtends the angle a for radius r.

central :: Length -> Length -> Angle Source #

central l r computes the central Angle from the arc length l and radius r.

clockwiseDifference :: Angle -> Angle -> Angle Source #

clockwiseDifference f s computes the angle between given angles, rotating clockwise.

isNegative :: Angle -> Bool Source #

Is given Angle < 0?

isWithin :: Angle -> Angle -> Angle -> Bool Source #

Is given Angle within range [low..high] inclusive?

negate :: Angle -> Angle Source #

Returns the given Angle negated.

normalise :: Angle -> Angle -> Angle Source #

normalise a n normalises a to [0, n].

Trigonometric functions

asin :: Double -> Angle Source #

asin a computes arc sine of a.

atan2 :: Double -> Double -> Angle Source #

atan2 y x computes the Angle (from the positive x-axis) of the vector from the origin to the point (x,y).

cos :: Angle -> Double Source #

cos a returns the cosinus of a.

sin :: Angle -> Double Source #

sin a returns the sinus of a.

Accessors

getDegrees :: Angle -> Int Source #

getDegrees a returns the degree component of a.

getArcminutes :: Angle -> Int Source #

getArcminutes a returns the arcminute component of a.

getArcseconds :: Angle -> Int Source #

getArcseconds a returns the arcsecond component of a.

getArcmilliseconds :: Angle -> Int Source #

getArcmilliseconds a returns the arcmilliseconds component of a.

Conversions

toDecimalDegrees :: Angle -> Double Source #

Converts the given Angle to decimal degrees.

toRadians :: Angle -> Double Source #

degrees to radians.

Read

angle :: ReadP Angle Source #

Parses and returns an Angle.

Supported formats:

  • d°m′s.ms″ - e.g. 55°36'21.3", where minutes, seconds and milliseconds are optional.
  • decimal° - e.g. 55.6050° or -133°

Symbols:

  • degree: ° or d
  • minute: ', ′ or m
  • second: ", ″, '' or s

read :: String -> Maybe Angle Source #

Reads an Angle from the given string using angle.

Misc

add :: Angle -> Angle -> Angle Source #

Adds 2 angles.

subtract :: Angle -> Angle -> Angle Source #

Subtracts 2 angles.

zero :: Angle Source #

0 degrees.