]> git.mxchange.org Git - flightgear.git/blobdiff - src/Time/moonpos.cxx
- adjusted for no-value constructor for FGPanel
[flightgear.git] / src / Time / moonpos.cxx
index aa8d19228a32630c9d4f7b272135932542f396c2..8cac8cafdffb35566cab2ec8cd3809a67e9627c2 100644 (file)
 /*
  * assuming the apparent orbit of the moon about the earth is circular,
  * the rate at which the orbit progresses is given by RadsPerDay --
- * FG_2PI radians per orbit divided by 365.242191 days per year:
+ * SG_2PI radians per orbit divided by 365.242191 days per year:
  */
 
-#define RadsPerDay (FG_2PI/365.242191)
+#define RadsPerDay (SG_2PI/365.242191)
 
 /*
  * details of moon's apparent orbit at epoch 1990.0 (after
@@ -99,8 +99,8 @@
  * Eccentricity (eccentricity of orbit)                0.016713
  */
 
-#define Epsilon_g    (279.403303*(FG_2PI/360))
-#define OmegaBar_g   (282.768422*(FG_2PI/360))
+#define Epsilon_g    (279.403303*(SGD_2PI/360))
+#define OmegaBar_g   (282.768422*(SGD_2PI/360))
 #define Eccentricity (0.016713)
 
 /*
  * 1990.0 (computed as 23.440592 degrees according to the method given
  * in duffett-smith, section 27)
  */
-#define MeanObliquity (23.440592*(FG_2PI/360))
+#define MeanObliquity (23.440592*(SGD_2PI/360))
 
 /* static double solve_keplers_equation(double); */
 /* static double moon_ecliptic_longitude(time_t); */
@@ -149,11 +149,11 @@ static double moon_ecliptic_longitude(time_t ssue) {
     D = DaysSinceEpoch(ssue);
 
     N = RadsPerDay * D;
-    N = fmod(N, FG_2PI);
-    if (N < 0) N += FG_2PI;
+    N = fmod(N, SG_2PI);
+    if (N < 0) N += SG_2PI;
 
     M_moon = N + Epsilon_g - OmegaBar_g;
-    if (M_moon < 0) M_moon += FG_2PI;
+    if (M_moon < 0) M_moon += SG_2PI;
 
     E = solve_keplers_equation(M_moon);
     v = 2 * atan(sqrt((1+Eccentricity)/(1-Eccentricity)) * tan(E/2));
@@ -200,7 +200,7 @@ static double julian_date(int y, int m, int d) {
 
     /* lazy test to ensure gregorian calendar */
     if (y < 1583) {
-       FG_LOG( FG_EVENT, FG_ALERT, 
+       SG_LOG( SG_EVENT, SG_ALERT, 
                "WHOOPS! Julian dates only valid for 1582 oct 15 or later" );
     }
 
@@ -283,13 +283,13 @@ void fgMoonPosition(time_t ssue, double *lon, double *lat) {
 
     ecliptic_to_equatorial( globals->get_ephem()->get_moon()->getLon(),
                            0.0, &alpha, &delta );
-    tmp = alpha - (FG_2PI/24)*GST(ssue);
-    if (tmp < -FG_PI) {
-       do tmp += FG_2PI;
-       while (tmp < -FG_PI);
-    } else if (tmp > FG_PI) {
-       do tmp -= FG_2PI;
-       while (tmp < -FG_PI);
+    tmp = alpha - (SGD_2PI/24)*GST(ssue);
+    if (tmp < -SGD_PI) {
+       do tmp += SGD_2PI;
+       while (tmp < -SGD_PI);
+    } else if (tmp > SGD_PI) {
+       do tmp -= SGD_2PI;
+       while (tmp < -SGD_PI);
     }
 
     *lon = tmp;
@@ -317,14 +317,14 @@ static void fgMoonPositionGST(double gst, double *lon, double *lat) {
                            globals->get_ephem()->get_moon()->getLat(), 
                            &alpha,  &delta );
 
-//    tmp = alpha - (FG_2PI/24)*GST(ssue);
-    tmp = alpha - (FG_2PI/24)*gst;     
-    if (tmp < -FG_PI) {
-       do tmp += FG_2PI;
-       while (tmp < -FG_PI);
-    } else if (tmp > FG_PI) {
-       do tmp -= FG_2PI;
-       while (tmp < -FG_PI);
+//    tmp = alpha - (SG_2PI/24)*GST(ssue);
+    tmp = alpha - (SGD_2PI/24)*gst;    
+    if (tmp < -SGD_PI) {
+       do tmp += SGD_2PI;
+       while (tmp < -SGD_PI);
+    } else if (tmp > SGD_PI) {
+       do tmp -= SGD_2PI;
+       while (tmp < -SGD_PI);
     }
 
     *lon = tmp;
@@ -352,7 +352,7 @@ void fgUpdateMoonPos( void ) {
     SGTime *t = globals->get_time_params();
     v = (FGViewerRPH *)globals->get_current_view();
 
-    FG_LOG( FG_EVENT, FG_INFO, "  Updating Moon position" );
+    SG_LOG( SG_EVENT, SG_INFO, "  Updating Moon position" );
 
     // (not sure why there was two)
     // fgMoonPosition(t->cur_time, &l->moon_lon, &moon_gd_lat);
@@ -363,8 +363,8 @@ void fgUpdateMoonPos( void ) {
     p = Point3D( l->moon_lon, l->moon_gc_lat, sl_radius );
     l->fg_moonpos = sgPolarToCart3d(p);
 
-    FG_LOG( FG_EVENT, FG_INFO, "    t->cur_time = " << t->get_cur_time() );
-    FG_LOG( FG_EVENT, FG_INFO, 
+    SG_LOG( SG_EVENT, SG_INFO, "    t->cur_time = " << t->get_cur_time() );
+    SG_LOG( SG_EVENT, SG_INFO, 
            "    Moon Geodetic lat = " << moon_gd_lat
            << " Geocentric lat = " << l->moon_gc_lat );
 
@@ -391,7 +391,7 @@ void fgUpdateMoonPos( void ) {
     //      << nmoon[2] << endl;
 
     l->moon_angle = acos( sgScalarProductVec3( nup, nmoon ) );
-    FG_LOG( FG_EVENT, FG_INFO, "moon angle relative to current location = " 
+    SG_LOG( SG_EVENT, SG_INFO, "moon angle relative to current location = " 
            << l->moon_angle );
     
     // calculate vector to moon's position on the earth's surface
@@ -435,7 +435,7 @@ void fgUpdateMoonPos( void ) {
        l->moon_rotation = -acos(dot);
     }
     // cout << "  Sky needs to rotate = " << angle << " rads = "
-    //      << angle * RAD_TO_DEG << " degrees." << endl;
+    //      << angle * SGD_RADIANS_TO_DEGREES << " degrees." << endl;
 }