known time.
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
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;
}
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] );
+
}
#define _EPHEMERIS_HXX
+#include <plib/sg.h>
+
#include <Time/fg_time.hxx>
#include "star.hxx"
#include "moon.hxx"
+#include "mercury.hxx"
+#include "venus.hxx"
+#include "mars.hxx"
+#include "jupiter.hxx"
+#include "saturn.hxx"
+#include "uranus.hxx"
+#include "neptune.hxx"
class FGEphemeris {
Star *our_sun;
Moon *moon;
+ Mercury *mercury;
+ Venus *venus;
+ Mars *mars;
+ Jupiter *jupiter;
+ Saturn *saturn;
+ Uranus *uranus;
+ Neptune *neptune;
+
+ // 9 planets - earth - pluto which we don't draw = 7
+ // planets[i][0] = Right Ascension
+ // planets[i][1] = Declination
+ // planets[i][2] = Magnitude
+ sgdVec3 planets[7];
public:
void update(FGTime *t);
// sun position
- inline double getSunRightAscension() {
+ inline double getSunRightAscension() const {
return our_sun->getRightAscension();
}
- inline double getSunDeclination() {
+ inline double getSunDeclination() const {
return our_sun->getDeclination();
}
// moon position
- inline double getMoonRightAscension() {
+ inline double getMoonRightAscension() const {
return moon->getRightAscension();
}
- inline double getMoonDeclination() {
+ inline double getMoonDeclination() const {
return moon->getDeclination();
}
+
+ // planets
+ inline sgdVec3 *getPlanets() const {
+ return planets;
+ }
};
{
}
+Jupiter::Jupiter() :
+ CelestialBody(100.4542, 2.7685400E-5,
+ 1.3030, -1.557E-7,
+ 273.8777, 1.6450500E-5,
+ 5.2025600, 0.000000,
+ 0.048498, 4.469E-9,
+ 19.89500, 0.08308530010)
+{
+}
+
/*************************************************************************
* void Jupiter::updatePosition(FGTime *t, Star *ourSun)
*
{
public:
Jupiter (FGTime *t);
+ Jupiter ();
void updatePosition(FGTime *t, Star *ourSun);
};
18.60210, 0.52402077660, t)
{
}
+Mars::Mars() :
+ CelestialBody(49.55740, 2.1108100E-5,
+ 1.8497, -1.78E-8,
+ 286.5016, 2.9296100E-5,
+ 1.5236880, 0.000000,
+ 0.093405, 2.516E-9,
+ 18.60210, 0.52402077660)
+{
+}
/*************************************************************************
* void Mars::updatePosition(FGTime *t, Star *ourSun)
*
{
public:
Mars ( FGTime *t);
+ Mars ();
void updatePosition(FGTime *t, Star *ourSun);
};
168.6562, 4.09233443680, t)
{
}
+Mercury::Mercury() :
+ CelestialBody (48.33130, 3.2458700E-5,
+ 7.0047, 5.00E-8,
+ 29.12410, 1.0144400E-5,
+ 0.3870980, 0.000000,
+ 0.205635, 5.59E-10,
+ 168.6562, 4.09233443680)
+{
+}
/*************************************************************************
* void Mercury::updatePosition(FGTime *t, Star *ourSun)
*
{
public:
Mercury ( FGTime *t);
+ Mercury ();
void updatePosition(FGTime *t, Star* ourSun);
};
260.2471, 0.00599514700, t)
{
}
+Neptune::Neptune() :
+ CelestialBody(131.7806, 3.0173000E-5,
+ 1.7700, -2.550E-7,
+ 272.8461, -6.027000E-6,
+ 30.058260, 3.313E-8,
+ 0.008606, 2.150E-9,
+ 260.2471, 0.00599514700)
+{
+}
/*************************************************************************
* void Neptune::updatePosition(FGTime *t, Star *ourSun)
*
{
public:
Neptune ( FGTime *t);
+ Neptune ();
void updatePosition(FGTime *t, Star *ourSun);
};
class Pluto : public CelestialBody
{
public:
- Pluto ( FGTime t);
+ Pluto ( FGTime *t);
+ Pluto ();
};
#endif // _PLUTO_HXX_
316.9670, 0.03344422820, t)
{
}
+Saturn::Saturn() :
+ CelestialBody(113.6634, 2.3898000E-5,
+ 2.4886, -1.081E-7,
+ 339.3939, 2.9766100E-5,
+ 9.5547500, 0.000000,
+ 0.055546, -9.499E-9,
+ 316.9670, 0.03344422820)
+{
+}
/*************************************************************************
* void Saturn::updatePosition(FGTime *t, Star *ourSun)
{
public:
Saturn ( FGTime *t);
+ Saturn ();
void updatePosition(FGTime *t, Star *ourSun);
};
142.5905, 0.01172580600, t)
{
}
+Uranus::Uranus() :
+ CelestialBody(74.00050, 1.3978000E-5,
+ 0.7733, 1.900E-8,
+ 96.66120, 3.0565000E-5,
+ 19.181710, -1.55E-8,
+ 0.047318, 7.450E-9,
+ 142.5905, 0.01172580600)
+{
+}
/*************************************************************************
* void Uranus::updatePosition(FGTime *t, Star *ourSun)
{
public:
Uranus ( FGTime *t);
+ Uranus ();
void updatePosition(FGTime *t, Star *ourSun);
};
48.00520, 1.60213022440, t)
{
}
+Venus::Venus() :
+ CelestialBody(76.67990, 2.4659000E-5,
+ 3.3946, 2.75E-8,
+ 54.89100, 1.3837400E-5,
+ 0.7233300, 0.000000,
+ 0.006773, -1.302E-9,
+ 48.00520, 1.60213022440)
+{
+}
/*************************************************************************
* void Venus::updatePosition(FGTime *t, Star *ourSun)
{
public:
Venus ( FGTime *t);
+ Venus ();
void updatePosition(FGTime *t, Star *ourSun);
};