diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-07-16 17:14:30 +0200 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-07-16 17:14:30 +0200 |
commit | 4fc8799d38226363522e5711a645bfaea2b304ff (patch) | |
tree | 63d56eab66512c63e42929b90655b4b04ecc6d4f /src | |
parent | Enable direnv and install hls (diff) | |
download | sky-info-4fc8799d38226363522e5711a645bfaea2b304ff.tar.gz sky-info-4fc8799d38226363522e5711a645bfaea2b304ff.tar.bz2 sky-info-4fc8799d38226363522e5711a645bfaea2b304ff.zip |
Diffstat (limited to 'src')
-rw-r--r-- | src/#Logic.hs# | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/#Logic.hs# b/src/#Logic.hs# new file mode 100644 index 0000000..25214ed --- /dev/null +++ b/src/#Logic.hs# @@ -0,0 +1,49 @@ +module Logic where + +import Data.Astro.Types +import Data.Astro.Time.JulianDate +import Data.Astro.Coordinate +import Data.Astro.Planet + +data SkyT = Sky { s_date :: JulianDate, + objects :: [SkyObjectT] + } deriving (Show) + +data RelativeSkyT = RelativeSky { rs_date :: JulianDate, + nonVisibleObjects :: [SkyObjectT], + visibleObjects :: [SkyObjectT] + } deriving (Show) + +data SkyObjectT = SkyObject { + so_name :: String, + coordinates :: EquatorialCoordinates1 +} deriving (Show) + +data RelativeSkyObjectT = RelativeSkyObject { + rso_name :: String + --m_relative_coordinates :: HorizonCoordinates +} deriving (Show) + +generateSky :: JulianDate -> SkyT +generateSky date = Sky { + s_date = date, + objects = predictSkyObjects date + } + +trackedObjects :: [Planet] +trackedObjects = [Mercury, Venus, Mars, Jupiter, Saturn, Neptune, Uranus] --Moon? + +predictSkyObjects :: JulianDate -> [SkyObjectT] +predictSkyObjects date = do + object <- trackedObjects + objectDetails <- return $ j2010PlanetDetails object + earthDetails <- return $ j2010PlanetDetails Earth + objectPosition <- return $ planetPosition planetTrueAnomaly1 objectDetails earthDetails date + return SkyObject { so_name = show object, coordinates = objectPosition } + +relativize_sky :: SkyT -> GeographicCoordinates -> RelativeSkyT +relativize_sky sky location = RelativeSky { + rs_date = s_date sky, + nonVisibleObjects = objects sky, + visibleObjects = [] + }λ> λ> \ No newline at end of file |