Copyright | Alexander Ignatyev 2016 |
---|---|
Safe Haskell | Safe |
Language | Haskell2010 |
Data.Astro.Types
Description
Common Types are usfull across all subsystems like Time and Coordinate.
Examples
Decimal hours and Decimal degrees
import Data.Astro.Types -- 10h 15m 19.7s dh :: DecimalHours dh = fromHMS 10 15 19.7 -- DH 10.255472222222222 (h, m, s) = toHMS dh -- (10,15,19.699999999999562) -- 51°28′40″ dd :: DecimalDegrees dd = fromDMS 51 28 40 -- DD 51.477777777777774 (d, m, s) = toDMS dd -- (51,28,39.999999999987494)
Geographic Coordinates
import Data.Astro.Types -- the Royal Observatory, Greenwich ro :: GeographicCoordinates ro = GeoC (fromDMS 51 28 40) (-(fromDMS 0 0 5)) -- GeoC {geoLatitude = DD 51.4778, geoLongitude = DD (-0.0014)}
- newtype DecimalDegrees = DD Double
- newtype DecimalHours = DH Double
- data GeographicCoordinates = GeoC {}
- newtype AstronomicalUnits = AU Double
- lightTravelTime :: AstronomicalUnits -> DecimalHours
- kmToAU :: Double -> AstronomicalUnits
- auToKM :: AstronomicalUnits -> Double
- toDecimalHours :: DecimalDegrees -> DecimalHours
- fromDecimalHours :: DecimalHours -> DecimalDegrees
- toRadians :: DecimalDegrees -> Double
- fromRadians :: Double -> DecimalDegrees
- fromDMS :: RealFrac a => Int -> Int -> a -> DecimalDegrees
- toDMS :: (Integral b, Integral a) => DecimalDegrees -> (a, b, Double)
- fromHMS :: RealFrac a => Int -> Int -> a -> DecimalHours
- toHMS :: (Integral b, Integral a) => DecimalHours -> (a, b, Double)
Documentation
newtype DecimalDegrees #
newtype DecimalHours #
newtype AstronomicalUnits #
Astronomical Units, 1AU = 1.4960×1011 m (originally, the average distance of Earth's aphelion and perihelion).
lightTravelTime :: AstronomicalUnits -> DecimalHours #
Light travel time of the distance in Astronomical Units
kmToAU :: Double -> AstronomicalUnits #
Convert from kilometers to Astronomical Units
auToKM :: AstronomicalUnits -> Double #
Comvert from Astronomical Units to kilometers
toDecimalHours :: DecimalDegrees -> DecimalHours #
Convert decimal degrees to decimal hours
fromDecimalHours :: DecimalHours -> DecimalDegrees #
Convert decimal hours to decimal degrees
toRadians :: DecimalDegrees -> Double #
Convert from DecimalDegrees to Radians
fromRadians :: Double -> DecimalDegrees #
Convert from Radians to DecimalDegrees
fromDMS :: RealFrac a => Int -> Int -> a -> DecimalDegrees #
Convert Degrees, Minutes, Seconds to DecimalDegrees
toDMS :: (Integral b, Integral a) => DecimalDegrees -> (a, b, Double) #
Convert DecimalDegrees to Degrees, Minutes, Seconds