{-|
Module: Data.Astro.Moon.MoonDetails
Description: Planet Details
Copyright: Alexander Ignatyev, 2016

Moon Details.
-}

module Data.Astro.Moon.MoonDetails
(
  MoonDetails(..)
  , MoonDistanceUnits(..)
  , j2010MoonDetails
  , mduToKm
)

where

import Data.Astro.Types (DecimalDegrees)
import Data.Astro.Time.Epoch (j2010)
import Data.Astro.Time.JulianDate (JulianDate(..))


-- | Details of the Moon's orbit at the epoch

data MoonDetails = MoonDetails {
  MoonDetails -> JulianDate
mdEpoch :: JulianDate     -- ^ the epoch

  , MoonDetails -> DecimalDegrees
mdL :: DecimalDegrees   -- ^ mean longitude at the epoch

  , MoonDetails -> DecimalDegrees
mdP :: DecimalDegrees   -- ^ mean longitude of the perigee at the epoch

  , MoonDetails -> DecimalDegrees
mdN :: DecimalDegrees   -- ^ mean longitude of the node at the epoch

  , MoonDetails -> DecimalDegrees
mdI :: DecimalDegrees   -- ^ inclination of the orbit

  , MoonDetails -> Double
mdE :: Double           -- ^ eccentricity of the orbit

  , MoonDetails -> Double
mdA :: Double           -- ^ semi-major axis of the orbit

  , MoonDetails -> DecimalDegrees
mdBigTheta :: DecimalDegrees  -- ^ angular diameter at the distance `mdA` from the Earth

  , MoonDetails -> DecimalDegrees
mdPi :: DecimalDegrees        -- ^ parallax at distance `mdA` from the Earth

  } deriving (Int -> MoonDetails -> ShowS
[MoonDetails] -> ShowS
MoonDetails -> String
(Int -> MoonDetails -> ShowS)
-> (MoonDetails -> String)
-> ([MoonDetails] -> ShowS)
-> Show MoonDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MoonDetails] -> ShowS
$cshowList :: [MoonDetails] -> ShowS
show :: MoonDetails -> String
$cshow :: MoonDetails -> String
showsPrec :: Int -> MoonDetails -> ShowS
$cshowsPrec :: Int -> MoonDetails -> ShowS
Show)


-- | Moon distance units, 1 MDU = semi-major axis of the Moon's orbit

newtype MoonDistanceUnits = MDU Double deriving (Int -> MoonDistanceUnits -> ShowS
[MoonDistanceUnits] -> ShowS
MoonDistanceUnits -> String
(Int -> MoonDistanceUnits -> ShowS)
-> (MoonDistanceUnits -> String)
-> ([MoonDistanceUnits] -> ShowS)
-> Show MoonDistanceUnits
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MoonDistanceUnits] -> ShowS
$cshowList :: [MoonDistanceUnits] -> ShowS
show :: MoonDistanceUnits -> String
$cshow :: MoonDistanceUnits -> String
showsPrec :: Int -> MoonDistanceUnits -> ShowS
$cshowsPrec :: Int -> MoonDistanceUnits -> ShowS
Show)


j2010MoonDetails :: MoonDetails
j2010MoonDetails = JulianDate
-> DecimalDegrees
-> DecimalDegrees
-> DecimalDegrees
-> DecimalDegrees
-> Double
-> Double
-> DecimalDegrees
-> DecimalDegrees
-> MoonDetails
MoonDetails JulianDate
j2010 DecimalDegrees
91.929336 DecimalDegrees
130.143076 DecimalDegrees
291.682547 DecimalDegrees
5.145396 Double
0.0549 Double
384401 DecimalDegrees
0.5181 DecimalDegrees
0.9507


-- | Convert MoonDistanceUnits to km

mduToKm :: MoonDistanceUnits -> Double
mduToKm :: MoonDistanceUnits -> Double
mduToKm (MDU Double
p) = Double
p Double -> Double -> Double
forall a. Num a => a -> a -> a
* (MoonDetails -> Double
mdA MoonDetails
j2010MoonDetails)