| Copyright | (c) 2020 Cedric Liegeois |
|---|---|
| License | BSD3 |
| Maintainer | Cedric Liegeois <ofmooseandmen@yahoo.fr> |
| Stability | experimental |
| Portability | portable |
| Safe Haskell | Safe |
| Language | Haskell2010 |
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
- data Angle
- decimalDegrees :: Double -> Angle
- dms :: Int -> Int -> Double -> Either String Angle
- radians :: Double -> Angle
- arcLength :: Angle -> Length -> Length
- central :: Length -> Length -> Angle
- clockwiseDifference :: Angle -> Angle -> Angle
- isNegative :: Angle -> Bool
- isWithin :: Angle -> Angle -> Angle -> Bool
- negate :: Angle -> Angle
- normalise :: Angle -> Angle -> Angle
- asin :: Double -> Angle
- atan2 :: Double -> Double -> Angle
- cos :: Angle -> Double
- sin :: Angle -> Double
- getDegrees :: Angle -> Int
- getArcminutes :: Angle -> Int
- getArcseconds :: Angle -> Int
- getArcmilliseconds :: Angle -> Int
- toDecimalDegrees :: Angle -> Double
- toRadians :: Angle -> Double
- angle :: ReadP Angle
- read :: String -> Maybe Angle
- add :: Angle -> Angle -> Angle
- subtract :: Angle -> Angle -> Angle
- zero :: Angle
The Angle type
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.
Smart constructors
decimalDegrees :: Double -> Angle Source #
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.
isWithin :: Angle -> Angle -> Angle -> Bool Source #
Is given Angle within range [low..high] inclusive?
Trigonometric functions
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).
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
Read
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