From 09b67e9440e8fdb5addd199fdd1f2446a84c4127 Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 16 Mar 2000 03:00:58 +0000 Subject: [PATCH] Updated to eliminate rendering component and allow initialization without a known time. --- simgear/ephemeris/celestialBody.cxx | 4 ++-- simgear/ephemeris/ephemeris.cxx | 32 ++++++++++++++++++++++++++ simgear/ephemeris/ephemeris.hxx | 35 +++++++++++++++++++++++++---- simgear/ephemeris/jupiter.cxx | 10 +++++++++ simgear/ephemeris/jupiter.hxx | 1 + simgear/ephemeris/mars.cxx | 9 ++++++++ simgear/ephemeris/mars.hxx | 1 + simgear/ephemeris/mercury.cxx | 9 ++++++++ simgear/ephemeris/mercury.hxx | 1 + simgear/ephemeris/neptune.cxx | 9 ++++++++ simgear/ephemeris/neptune.hxx | 1 + simgear/ephemeris/pluto.hxx | 3 ++- simgear/ephemeris/saturn.cxx | 9 ++++++++ simgear/ephemeris/saturn.hxx | 1 + simgear/ephemeris/uranus.cxx | 9 ++++++++ simgear/ephemeris/uranus.hxx | 1 + simgear/ephemeris/venus.cxx | 9 ++++++++ simgear/ephemeris/venus.hxx | 1 + 18 files changed, 138 insertions(+), 7 deletions(-) diff --git a/simgear/ephemeris/celestialBody.cxx b/simgear/ephemeris/celestialBody.cxx index a46a34df..d8ea4b36 100644 --- a/simgear/ephemeris/celestialBody.cxx +++ b/simgear/ephemeris/celestialBody.cxx @@ -87,8 +87,8 @@ void CelestialBody::updatePosition(FGTime *t, 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 : " - << rightAscension << " (ra), " << declination << " (dec)" ); + /* FG_LOG(FG_GENERAL, FG_INFO, "Planet found at : " + << rightAscension << " (ra), " << declination << " (dec)" ); */ //calculate some variables specific to calculating the magnitude //of the planet diff --git a/simgear/ephemeris/ephemeris.cxx b/simgear/ephemeris/ephemeris.cxx index 86a6047e..c795a858 100644 --- a/simgear/ephemeris/ephemeris.cxx +++ b/simgear/ephemeris/ephemeris.cxx @@ -29,6 +29,13 @@ FGEphemeris::FGEphemeris( void ) { our_sun = new Star; moon = new Moon; + mercury = new Mercury; + venus = new Venus; + mars = new Mars; + jupiter = new Jupiter; + saturn = new Saturn; + uranus = new Uranus; + neptune = new Neptune; } @@ -36,13 +43,38 @@ FGEphemeris::FGEphemeris( void ) { FGEphemeris::~FGEphemeris( void ) { delete our_sun; delete moon; + delete mercury; + delete venus; + delete mars; + delete jupiter; + delete saturn; + delete uranus; + delete neptune; } // Update (recalculate) the positions of all objects for the specified // time void FGEphemeris::update( FGTime *t ) { + // update object positions our_sun->updatePosition( t ); moon->updatePosition( t, our_sun ); + mercury->updatePosition( t, our_sun ); + venus->updatePosition( t, our_sun ); + mars->updatePosition( t, our_sun ); + jupiter->updatePosition( t, our_sun ); + saturn->updatePosition( t, our_sun ); + uranus->updatePosition( t, our_sun ); + neptune->updatePosition( t, our_sun ); + + // update planets list + mercury->getPos( &planets[0][0], &planets[0][1], &planets[0][2] ); + venus ->getPos( &planets[1][0], &planets[1][1], &planets[1][2] ); + mars ->getPos( &planets[2][0], &planets[2][1], &planets[2][2] ); + jupiter->getPos( &planets[3][0], &planets[3][1], &planets[3][2] ); + saturn ->getPos( &planets[4][0], &planets[4][1], &planets[4][2] ); + uranus ->getPos( &planets[5][0], &planets[5][1], &planets[5][2] ); + neptune->getPos( &planets[6][0], &planets[6][1], &planets[6][2] ); + } diff --git a/simgear/ephemeris/ephemeris.hxx b/simgear/ephemeris/ephemeris.hxx index 59c876f0..b57fc02c 100644 --- a/simgear/ephemeris/ephemeris.hxx +++ b/simgear/ephemeris/ephemeris.hxx @@ -26,16 +26,38 @@ #define _EPHEMERIS_HXX +#include + #include