Copyright | Alexander Ignatyev 2016 |
---|---|
Safe Haskell | Safe |
Language | Haskell2010 |
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 t, Integral t1) => DecimalDegrees -> (t1, t, Double)
- fromHMS :: RealFrac a => Int -> Int -> a -> DecimalHours
- toHMS :: (Integral t, Integral t1) => DecimalHours -> (t1, t, Double)
Documentation
newtype DecimalDegrees Source #
newtype DecimalHours Source #
data GeographicCoordinates Source #
Geographic Coordinates
newtype AstronomicalUnits Source #
Astronomical Units, 1AU = 1.4960×1011 m (originally, the average distance of Earth's aphelion and perihelion).
lightTravelTime :: AstronomicalUnits -> DecimalHours Source #
Light travel time of the distance in Astronomical Units
kmToAU :: Double -> AstronomicalUnits Source #
Convert from kilometers to Astronomical Units
auToKM :: AstronomicalUnits -> Double Source #
Comvert from Astronomical Units to kilometers
toDecimalHours :: DecimalDegrees -> DecimalHours Source #
Convert decimal degrees to decimal hours
fromDecimalHours :: DecimalHours -> DecimalDegrees Source #
Convert decimal hours to decimal degrees
toRadians :: DecimalDegrees -> Double Source #
Convert from DecimalDegrees to Radians
fromRadians :: Double -> DecimalDegrees Source #
Convert from Radians to DecimalDegrees
fromDMS :: RealFrac a => Int -> Int -> a -> DecimalDegrees Source #
Convert Degrees, Minutes, Seconds to DecimalDegrees
toDMS :: (Integral t, Integral t1) => DecimalDegrees -> (t1, t, Double) Source #
Convert DecimalDegrees to Degrees, Minutes, Seconds