]> git.mxchange.org Git - simgear.git/blobdiff - simgear/ephemeris/celestialBody.cxx
Patch from Melchior Franz:
[simgear.git] / simgear / ephemeris / celestialBody.cxx
index d2b1b722288556b84535900ff34fa6bb86f7cb7f..ae6a792982890b5aa3f22198c109371870adf7b9 100644 (file)
@@ -25,7 +25,7 @@
 
 #include <simgear/debug/logstream.hxx>
 
-#ifdef FG_MATH_EXCEPTION_CLASH
+#ifdef SG_MATH_EXCEPTION_CLASH
 #  define exception c_exception
 #endif
 #include <math.h>
@@ -59,12 +59,12 @@ void CelestialBody::updatePosition(double mjd, Star *ourSun)
     xv, yv, xh, yh, zh, xg, yg, zg, xe, ye, ze;
 
   updateOrbElements(mjd);
-  actTime = fgCalcActTime(mjd);
+  actTime = sgCalcActTime(mjd);
 
   // calcualate the angle bewteen ecliptic and equatorial coordinate system
-  ecl = DEG_TO_RAD * (23.4393 - 3.563E-7 *actTime);
+  ecl = SGD_DEGREES_TO_RADIANS * (23.4393 - 3.563E-7 *actTime);
   
-  eccAnom = fgCalcEccAnom(M, e);  //calculate the eccentric anomaly
+  eccAnom = sgCalcEccAnom(M, e);  //calculate the eccentric anomaly
   xv = a * (cos(eccAnom) - e);
   yv = a * (sqrt (1.0 - e*e) * sin(eccAnom));
   v = atan2(yv, xv);           // the planet's true anomaly
@@ -88,7 +88,7 @@ void CelestialBody::updatePosition(double mjd, Star *ourSun)
   ze = yg * sin(ecl) + zg * cos(ecl);
   rightAscension = atan2(ye, xe);
   declination = atan2(ze, sqrt(xe*xe + ye*ye));
-  /* FG_LOG(FG_GENERAL, FG_INFO, "Planet found at : " 
+  /* SG_LOG(SG_GENERAL, SG_INFO, "Planet found at : " 
         << rightAscension << " (ra), " << declination << " (dec)" ); */
 
   //calculate some variables specific to calculating the magnitude 
@@ -107,11 +107,11 @@ void CelestialBody::updatePosition(double mjd, Star *ourSun)
       tmp = -1.0;
   }
 
-  FV = RAD_TO_DEG * acos( tmp );
-};
+  FV = SGD_RADIANS_TO_DEGREES * acos( tmp );
+}
 
 /****************************************************************************
- * double CelestialBody::fgCalcEccAnom(double M, double e)
+ * double CelestialBody::sgCalcEccAnom(double M, double e)
  * this private member calculates the eccentric anomaly of a celestial body, 
  * given its mean anomaly and eccentricity.
  * 
@@ -136,7 +136,7 @@ void CelestialBody::updatePosition(double mjd, Star *ourSun)
  * the eccentric anomaly
  *
  ****************************************************************************/
-double CelestialBody::fgCalcEccAnom(double M, double e)
+double CelestialBody::sgCalcEccAnom(double M, double e)
 {
   double 
     eccAnom, E0, E1, diff;
@@ -152,7 +152,7 @@ double CelestialBody::fgCalcEccAnom(double M, double e)
          diff = fabs(E0 - E1);
          E0 = E1;
        }
-      while (diff > (DEG_TO_RAD * 0.001));
+      while (diff > (SGD_DEGREES_TO_RADIANS * 0.001));
       return E0;
     }
   return eccAnom;