about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBaitinq <manuelpalenzuelamerino@gmail.com>2022-07-01 20:30:26 +0200
committerBaitinq <manuelpalenzuelamerino@gmail.com>2022-07-02 12:16:33 +0200
commit649b8f73816c123ecb886510a1a3080d48a3bdf6 (patch)
tree2b378ffe3dc180ae272e52c063266b46a57dbf2b
parentAdd skeleton functionality (diff)
downloadsky-info-649b8f73816c123ecb886510a1a3080d48a3bdf6.tar.gz
sky-info-649b8f73816c123ecb886510a1a3080d48a3bdf6.tar.bz2
sky-info-649b8f73816c123ecb886510a1a3080d48a3bdf6.zip
Implemented predictSkyObjects
-rw-r--r--src/Logic.hs53
1 files changed, 35 insertions, 18 deletions
diff --git a/src/Logic.hs b/src/Logic.hs
index fb2a03b..8033f62 100644
--- a/src/Logic.hs
+++ b/src/Logic.hs
@@ -3,30 +3,47 @@ module Logic where
 import Data.Astro.Types
 import Data.Astro.Time.JulianDate
 import Data.Astro.Coordinate
+import Data.Astro.Planet
 
-data SkyT = Sky { date :: JulianDate,
+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 {
-    name :: String
-    --coordinates :: EquatorialCoordinates1
-    --m_relative_coordinates :: Maybe HorizonCoordinates
+    so_name :: String,
+    coordinates :: EquatorialCoordinates1
+} deriving (Show)
+
+data RelativeSkyObjectT = RelativeSkyObject {
+    rso_name :: String
+    --m_relative_coordinates :: HorizonCoordinates
 } deriving (Show)
 
 generateSky :: JulianDate -> SkyT
-generateSky date = let
-                                (nonVisibleObjects, visibleObjects) = predictSkyObjects date
-                            in 
-                                Sky { 
-                                    date = date,
-                                    nonVisibleObjects=nonVisibleObjects, 
-                                    visibleObjects=visibleObjects
-                                 }
-
-predictSkyObjects :: JulianDate -> ([SkyObjectT], [SkyObjectT])
-predictSkyObjects date = ([SkyObject { name="test" }], [SkyObject { name= "uwu" }])
-
-relativize_sky :: SkyT -> GeographicCoordinates -> SkyT
-relativize_sky sky location = sky
\ No newline at end of file
+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