File tree 2 files changed +43
-0
lines changed
2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ CPP = /usr/bin/g++
2
+ CFLAGS = -g -Wall -fPIC -Wextra
3
+ LIB_SGP4_DIR = ../../Libraries/sgp4/libsgp4
4
+ LIB_SGP4 = $(LIB_SGP4_DIR ) /libsgp4.a
5
+ INCLUDES = -I $(LIB_SGP4_DIR )
6
+
7
+ # -lrt required on linux for libsgp4's use of clock_gettime
8
+ solarposition : solarposition.o $(LIB_SGP4 )
9
+ $(CPP ) solarposition.o $(LIB_SGP4 ) -lrt -o $@
10
+
11
+ solarposition.o : solarposition.cpp
12
+ $(CPP ) $(CFLAGS ) $(INCLUDES ) -c solarposition.cpp
Original file line number Diff line number Diff line change
1
+ /*
2
+ * solarposition
3
+ *
4
+ * This program prints the current julian date, the current greenwich sidereal
5
+ * time (earth rotation in radians), and current location of the sun, expressed
6
+ * in Earth-centered inertial coordinate system kilometers. (w is direct radius)
7
+ * It is intended as a reference for other ECI solar position implementations.
8
+ */
9
+
10
+ #include < stdio.h>
11
+ #include " DateTime.h"
12
+ #include " SolarPosition.h"
13
+ #include " Vector.h"
14
+
15
+ int main (void ) {
16
+ SolarPosition sp;
17
+ DateTime date = DateTime::Now ();
18
+ Eci solar_eci = sp.FindPosition (date);
19
+ Vector pos_eci = solar_eci.Position ();
20
+ double julianDate = date.ToJulian ();
21
+ double gsidereal = date.ToGreenwichSiderealTime ();
22
+
23
+ printf (" d: %lf\n " , julianDate);
24
+ printf (" g: %lf\n " , gsidereal);
25
+ printf (" x: %lf\n " , pos_eci.x );
26
+ printf (" y: %lf\n " , pos_eci.y );
27
+ printf (" z: %lf\n " , pos_eci.z );
28
+ printf (" w: %lf\n " , pos_eci.w );
29
+
30
+ return 0 ;
31
+ }
You can’t perform that action at this time.
0 commit comments