X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fephemeris%2Fmoonpos.cxx;h=7908fa89cca3d1ca9df003cf0cfbbb5bf43396d6;hb=70c5d605641b628039f75cb8761ce783a17a5bdf;hp=ccc26418668cda743ffb41647e86ccfd7409e0b5;hpb=a7459489ff6624d5696814d0165d399220cef09d;p=simgear.git diff --git a/simgear/ephemeris/moonpos.cxx b/simgear/ephemeris/moonpos.cxx index ccc26418..7908fa89 100644 --- a/simgear/ephemeris/moonpos.cxx +++ b/simgear/ephemeris/moonpos.cxx @@ -15,10 +15,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * - * You should have received a copy of the GNU Library General Public - * License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * $Id$ **************************************************************************/ @@ -27,11 +26,7 @@ #include #include -#include -#ifdef __BORLANDC__ -# define exception c_exception -#endif #include // #include @@ -138,7 +133,7 @@ void MoonPos::updatePosition(double mjd, double lst, double lat, Star *ourSun) r += (-0.58 * cos(M - 2*D) -0.46 * cos(2*D) ); - // FG_LOG(FG_GENERAL, FG_INFO, "Running moon update"); + // SG_LOG(SG_GENERAL, SG_INFO, "Running moon update"); xg = r * cos(lonEcl) * cos(latEcl); yg = r * sin(lonEcl) * cos(latEcl); zg = r * sin(latEcl); @@ -150,7 +145,7 @@ void MoonPos::updatePosition(double mjd, double lst, double lat, Star *ourSun) geoRa = atan2(ye, xe); geoDec = atan2(ze, sqrt(xe*xe + ye*ye)); - /* FG_LOG( FG_GENERAL, FG_INFO, + /* SG_LOG( SG_GENERAL, SG_INFO, "(geocentric) geoRa = (" << (SGD_RADIANS_TO_DEGREES * geoRa) << "), geoDec= (" << (SGD_RADIANS_TO_DEGREES * geoDec) << ")" ); */ @@ -162,30 +157,40 @@ void MoonPos::updatePosition(double mjd, double lst, double lat, Star *ourSun) // First calculate the moon's parrallax, that is, the apparent size of the // (equatorial) radius of the earth, as seen from the moon mpar = asin ( 1 / r); - // FG_LOG( FG_GENERAL, FG_INFO, "r = " << r << " mpar = " << mpar ); - // FG_LOG( FG_GENERAL, FG_INFO, "lat = " << f->get_Latitude() ); + // SG_LOG( SG_GENERAL, SG_INFO, "r = " << r << " mpar = " << mpar ); + // SG_LOG( SG_GENERAL, SG_INFO, "lat = " << f->get_Latitude() ); gclat = lat - 0.003358 * sin (2 * SGD_DEGREES_TO_RADIANS * lat ); - // FG_LOG( FG_GENERAL, FG_INFO, "gclat = " << gclat ); + // SG_LOG( SG_GENERAL, SG_INFO, "gclat = " << gclat ); rho = 0.99883 + 0.00167 * cos(2 * SGD_DEGREES_TO_RADIANS * lat); - // FG_LOG( FG_GENERAL, FG_INFO, "rho = " << rho ); + // SG_LOG( SG_GENERAL, SG_INFO, "rho = " << rho ); if (geoRa < 0) - geoRa += (2*SGD_PI); + geoRa += SGD_2PI; HA = lst - (3.8197186 * geoRa); - /* FG_LOG( FG_GENERAL, FG_INFO, "t->getLst() = " << t->getLst() + /* SG_LOG( SG_GENERAL, SG_INFO, "t->getLst() = " << t->getLst() << " HA = " << HA ); */ g = atan (tan(gclat) / cos ((HA / 3.8197186))); - // FG_LOG( FG_GENERAL, FG_INFO, "g = " << g ); + // SG_LOG( SG_GENERAL, SG_INFO, "g = " << g ); rightAscension = geoRa - mpar * rho * cos(gclat) * sin(HA) / cos (geoDec); - declination = geoDec - mpar * rho * sin (gclat) * sin (g - geoDec) / sin(g); - - /* FG_LOG( FG_GENERAL, FG_INFO, + if (fabs(lat) > 0) { + declination + = geoDec - mpar * rho * sin (gclat) * sin (g - geoDec) / sin(g); + } else { + declination = geoDec; + // cerr << "Geocentric vs. Topocentric position" << endl; + // cerr << "RA (difference) : " + // << SGD_RADIANS_TO_DEGREES * (geoRa - rightAscension) << endl; + // cerr << "Dec (difference) : " + // << SGD_RADIANS_TO_DEGREES * (geoDec - declination) << endl; + } + + /* SG_LOG( SG_GENERAL, SG_INFO, "Ra = (" << (SGD_RADIANS_TO_DEGREES *rightAscension) << "), Dec= (" << (SGD_RADIANS_TO_DEGREES *declination) << ")" ); */ }