From f04e501472851cc1e3a4039f83d164864005568f Mon Sep 17 00:00:00 2001 From: Edward d'Auvergne Date: Mon, 7 Dec 2015 20:44:28 +0100 Subject: [PATCH] Exposure of the moon position. The following functions have been added: MoonPos::getM(), MoonPos::getw(), MoonPos::getxg(), MoonPos::getyg(), MoonPos::getye(), MoonPos::getze(), MoonPos::getDistance(). These are copied from and match the Star class functions (but with xs and ys replaced by xg and yg). --- simgear/ephemeris/moonpos.cxx | 3 ++- simgear/ephemeris/moonpos.hxx | 44 +++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/simgear/ephemeris/moonpos.cxx b/simgear/ephemeris/moonpos.cxx index 04ab9787..ff6fa569 100644 --- a/simgear/ephemeris/moonpos.cxx +++ b/simgear/ephemeris/moonpos.cxx @@ -78,7 +78,7 @@ void MoonPos::updatePosition(double mjd, double lst, double lat, Star *ourSun) { double eccAnom, ecl, actTime, - xv, yv, v, r, xh, yh, zh, xg, yg, zg, xe, ye, ze, + xv, yv, v, r, xh, yh, zh, zg, xe, Ls, Lm, D, F, mpar, gclat, rho, HA, g, geoRa, geoDec, cosN, sinN, cosvw, sinvw, sinvw_cosi, cosecl, sinecl, rcoslatEcl, @@ -149,6 +149,7 @@ void MoonPos::updatePosition(double mjd, double lst, double lat, Star *ourSun) r += (-0.58 * cos(MlesstwoD) -0.46 * cos(twoD) ); + distance = r; // SG_LOG(SG_GENERAL, SG_INFO, "Running moon update"); rcoslatEcl = r * cos(latEcl); xg = cos(lonEcl) * rcoslatEcl; diff --git a/simgear/ephemeris/moonpos.hxx b/simgear/ephemeris/moonpos.hxx index 6163249c..3462146e 100644 --- a/simgear/ephemeris/moonpos.hxx +++ b/simgear/ephemeris/moonpos.hxx @@ -36,6 +36,9 @@ class MoonPos : public CelestialBody private: + double xg, yg; // the moon's rectangular geocentric coordinates + double ye, ze; // the moon's rectangular equatorial coordinates + double distance; // the moon's distance to the earth // void TexInit(); // This should move to the constructor eventually. // GLUquadricObj *moonObject; @@ -54,7 +57,48 @@ public: ~MoonPos(); void updatePosition(double mjd, double lst, double lat, Star *ourSun); // void newImage(); + double getM() const; + double getw() const; + double getxg() const; + double getyg() const; + double getye() const; + double getze() const; + double getDistance() const; }; +inline double MoonPos::getM() const +{ + return M; +} + +inline double MoonPos::getw() const +{ + return w; +} + +inline double MoonPos::getxg() const +{ + return xg; +} + +inline double MoonPos::getyg() const +{ + return yg; +} + +inline double MoonPos::getye() const +{ + return ye; +} + +inline double MoonPos::getze() const +{ + return ze; +} + +inline double MoonPos::getDistance() const +{ + return distance; +} #endif // _MOONPOS_HXX_