Minor tidying up of interface.
This commit is contained in:
parent
cf1c7e7378
commit
1e53bedca5
@ -34,7 +34,7 @@
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
* void CelestialBody::updatePosition(SGTime *t, Star *ourSun)
|
||||
* void CelestialBody::updatePosition(double mjd, Star *ourSun)
|
||||
*
|
||||
* Basically, this member function provides a general interface for
|
||||
* calculating the right ascension and declinaion. This function is
|
||||
@ -45,20 +45,20 @@
|
||||
* position is calculated an a slightly different manner.
|
||||
*
|
||||
* arguments:
|
||||
* SGTime t: provides the current time.
|
||||
* double mjd: provides the modified julian date.
|
||||
* Star *ourSun: the sun's position is needed to convert heliocentric
|
||||
* coordinates into geocentric coordinates.
|
||||
*
|
||||
* return value: none
|
||||
*
|
||||
*************************************************************************/
|
||||
void CelestialBody::updatePosition(SGTime *t, Star *ourSun)
|
||||
void CelestialBody::updatePosition(double mjd, Star *ourSun)
|
||||
{
|
||||
double eccAnom, v, ecl, actTime,
|
||||
xv, yv, xh, yh, zh, xg, yg, zg, xe, ye, ze;
|
||||
|
||||
updateOrbElements(t);
|
||||
actTime = fgCalcActTime(t);
|
||||
updateOrbElements(mjd);
|
||||
actTime = fgCalcActTime(mjd);
|
||||
|
||||
// calcualate the angle bewteen ecliptic and equatorial coordinate system
|
||||
ecl = DEG_TO_RAD * (23.4393 - 3.563E-7 *actTime);
|
||||
|
@ -61,8 +61,8 @@ protected: // make the data protected, in order to give the
|
||||
double lonEcl, latEcl;
|
||||
|
||||
double fgCalcEccAnom(double M, double e);
|
||||
double fgCalcActTime(SGTime *t);
|
||||
void updateOrbElements(SGTime *t);
|
||||
double fgCalcActTime(double mjd);
|
||||
void updateOrbElements(double mjd);
|
||||
|
||||
public:
|
||||
CelestialBody(double Nf, double Ns,
|
||||
@ -70,7 +70,7 @@ public:
|
||||
double wf, double ws,
|
||||
double af, double as,
|
||||
double ef, double es,
|
||||
double Mf, double Ms, SGTime *t);
|
||||
double Mf, double Ms, double mjd);
|
||||
CelestialBody(double Nf, double Ns,
|
||||
double If, double Is,
|
||||
double wf, double ws,
|
||||
@ -84,7 +84,7 @@ public:
|
||||
double getMagnitude();
|
||||
double getLon();
|
||||
double getLat();
|
||||
void updatePosition(SGTime *t, Star *ourSun);
|
||||
void updatePosition(double mjd, Star *ourSun);
|
||||
};
|
||||
|
||||
/*****************************************************************************
|
||||
@ -112,7 +112,7 @@ inline CelestialBody::CelestialBody(double Nf, double Ns,
|
||||
double wf, double ws,
|
||||
double af, double as,
|
||||
double ef, double es,
|
||||
double Mf, double Ms, SGTime *t)
|
||||
double Mf, double Ms, double mjd)
|
||||
{
|
||||
NFirst = Nf; NSec = Ns;
|
||||
iFirst = If; iSec = Is;
|
||||
@ -120,7 +120,7 @@ inline CelestialBody::CelestialBody(double Nf, double Ns,
|
||||
aFirst = af; aSec = as;
|
||||
eFirst = ef; eSec = es;
|
||||
MFirst = Mf; MSec = Ms;
|
||||
updateOrbElements(t);
|
||||
updateOrbElements(mjd);
|
||||
};
|
||||
|
||||
inline CelestialBody::CelestialBody(double Nf, double Ns,
|
||||
@ -139,17 +139,17 @@ inline CelestialBody::CelestialBody(double Nf, double Ns,
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* inline void CelestialBody::updateOrbElements(SGTime *t)
|
||||
* inline void CelestialBody::updateOrbElements(double mjd)
|
||||
* given the current time, this private member calculates the actual
|
||||
* orbital elements
|
||||
*
|
||||
* Arguments: SGTime *t: the current time:
|
||||
* Arguments: double mjd: the current modified julian date:
|
||||
*
|
||||
* return value: none
|
||||
***************************************************************************/
|
||||
inline void CelestialBody::updateOrbElements(SGTime *t)
|
||||
inline void CelestialBody::updateOrbElements(double mjd)
|
||||
{
|
||||
double actTime = fgCalcActTime(t);
|
||||
double actTime = fgCalcActTime(mjd);
|
||||
M = DEG_TO_RAD * (MFirst + (MSec * actTime));
|
||||
w = DEG_TO_RAD * (wFirst + (wSec * actTime));
|
||||
N = DEG_TO_RAD * (NFirst + (NSec * actTime));
|
||||
@ -158,7 +158,7 @@ inline void CelestialBody::updateOrbElements(SGTime *t)
|
||||
a = aFirst + (aSec * actTime);
|
||||
}
|
||||
/*****************************************************************************
|
||||
* inline double CelestialBody::fgCalcActTime(SGTime *t)
|
||||
* inline double CelestialBody::fgCalcActTime(double mjd)
|
||||
* this private member function returns the offset in days from the epoch for
|
||||
* wich the orbital elements are calculated (Jan, 1st, 2000).
|
||||
*
|
||||
@ -166,9 +166,9 @@ inline void CelestialBody::updateOrbElements(SGTime *t)
|
||||
*
|
||||
* return value: the (fractional) number of days until Jan 1, 2000.
|
||||
****************************************************************************/
|
||||
inline double CelestialBody::fgCalcActTime(SGTime *t)
|
||||
inline double CelestialBody::fgCalcActTime(double mjd)
|
||||
{
|
||||
return (t->getMjd() - 36523.5);
|
||||
return (mjd - 36523.5);
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
|
||||
// Constructor
|
||||
FGEphemeris::FGEphemeris( const string &path ) {
|
||||
SGEphemeris::SGEphemeris( const string &path ) {
|
||||
our_sun = new Star;
|
||||
moon = new Moon;
|
||||
mercury = new Mercury;
|
||||
@ -36,12 +36,12 @@ FGEphemeris::FGEphemeris( const string &path ) {
|
||||
saturn = new Saturn;
|
||||
uranus = new Uranus;
|
||||
neptune = new Neptune;
|
||||
stars = new FGStars( FGPath(path) );
|
||||
stars = new SGStarData( FGPath(path) );
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
FGEphemeris::~FGEphemeris( void ) {
|
||||
SGEphemeris::~SGEphemeris( void ) {
|
||||
delete our_sun;
|
||||
delete moon;
|
||||
delete mercury;
|
||||
@ -57,17 +57,17 @@ FGEphemeris::~FGEphemeris( void ) {
|
||||
|
||||
// Update (recalculate) the positions of all objects for the specified
|
||||
// time
|
||||
void FGEphemeris::update( SGTime *t, double lat ) {
|
||||
void SGEphemeris::update( double mjd, double lst, double lat ) {
|
||||
// update object positions
|
||||
our_sun->updatePosition( t );
|
||||
moon->updatePosition( t, lat, 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 );
|
||||
our_sun->updatePosition( mjd );
|
||||
moon->updatePosition( mjd, lst, lat, our_sun );
|
||||
mercury->updatePosition( mjd, our_sun );
|
||||
venus->updatePosition( mjd, our_sun );
|
||||
mars->updatePosition( mjd, our_sun );
|
||||
jupiter->updatePosition( mjd, our_sun );
|
||||
saturn->updatePosition( mjd, our_sun );
|
||||
uranus->updatePosition( mjd, our_sun );
|
||||
neptune->updatePosition( mjd, our_sun );
|
||||
|
||||
// update planets list
|
||||
nplanets = 7;
|
||||
|
@ -1,7 +1,10 @@
|
||||
// ephemeris.hxx -- Top level class for calculating current positions of
|
||||
// astronomical objects
|
||||
//
|
||||
// Written by Curtis Olson, started March 2000.
|
||||
// Top level interface written by Curtis Olson, started March 2000.
|
||||
//
|
||||
// All the core code underneath this is written by Durk Talsma. See
|
||||
// the headers of all the other individual files for details.
|
||||
//
|
||||
// Copyright (C) 2000 Curtis L. Olson - curt@flightgear.org
|
||||
//
|
||||
@ -32,8 +35,6 @@
|
||||
|
||||
#include <plib/sg.h>
|
||||
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include "star.hxx"
|
||||
#include "moon.hxx"
|
||||
#include "mercury.hxx"
|
||||
@ -46,7 +47,7 @@
|
||||
#include "stars.hxx"
|
||||
|
||||
|
||||
class FGEphemeris {
|
||||
class SGEphemeris {
|
||||
|
||||
Star *our_sun;
|
||||
Moon *moon;
|
||||
@ -65,19 +66,19 @@ class FGEphemeris {
|
||||
int nplanets;
|
||||
sgdVec3 planets[7];
|
||||
|
||||
FGStars *stars;
|
||||
SGStarData *stars;
|
||||
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
FGEphemeris( const string &path );
|
||||
SGEphemeris( const string &path );
|
||||
|
||||
// Destructor
|
||||
~FGEphemeris( void );
|
||||
~SGEphemeris( void );
|
||||
|
||||
// Update (recalculate) the positions of all objects for the
|
||||
// specified time
|
||||
void update(SGTime *t, double lat);
|
||||
void update(double mjd, double lst, double lat);
|
||||
|
||||
// sun
|
||||
inline Star *get_sun() const { return our_sun; }
|
||||
|
@ -31,19 +31,19 @@
|
||||
#include "jupiter.hxx"
|
||||
|
||||
/*************************************************************************
|
||||
* Jupiter::Jupiter(SGTime *t)
|
||||
* Jupiter::Jupiter(double mjd)
|
||||
* Public constructor for class Jupiter
|
||||
* Argument: The current time.
|
||||
* the hard coded orbital elements for Jupiter are passed to
|
||||
* CelestialBody::CelestialBody();
|
||||
************************************************************************/
|
||||
Jupiter::Jupiter(SGTime *t) :
|
||||
Jupiter::Jupiter(double mjd) :
|
||||
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, t)
|
||||
19.89500, 0.08308530010, mjd)
|
||||
{
|
||||
}
|
||||
|
||||
@ -58,15 +58,15 @@ Jupiter::Jupiter() :
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* void Jupiter::updatePosition(SGTime *t, Star *ourSun)
|
||||
* void Jupiter::updatePosition(double mjd, Star *ourSun)
|
||||
*
|
||||
* calculates the current position of Jupiter, by calling the base class,
|
||||
* CelestialBody::updatePosition(); The current magnitude is calculated using
|
||||
* a Jupiter specific equation
|
||||
*************************************************************************/
|
||||
void Jupiter::updatePosition(SGTime *t, Star *ourSun)
|
||||
void Jupiter::updatePosition(double mjd, Star *ourSun)
|
||||
{
|
||||
CelestialBody::updatePosition(t, ourSun);
|
||||
CelestialBody::updatePosition(mjd, ourSun);
|
||||
magnitude = -9.25 + 5*log10( r*R ) + 0.014 * FV;
|
||||
}
|
||||
|
||||
|
@ -24,17 +24,15 @@
|
||||
#ifndef _JUPITER_HXX_
|
||||
#define _JUPITER_HXX_
|
||||
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include "celestialBody.hxx"
|
||||
#include "star.hxx"
|
||||
|
||||
class Jupiter : public CelestialBody
|
||||
{
|
||||
public:
|
||||
Jupiter (SGTime *t);
|
||||
Jupiter (double mjd);
|
||||
Jupiter ();
|
||||
void updatePosition(SGTime *t, Star *ourSun);
|
||||
void updatePosition(double mjd, Star *ourSun);
|
||||
};
|
||||
|
||||
#endif // _JUPITER_HXX_
|
||||
|
@ -30,19 +30,19 @@
|
||||
#include "mars.hxx"
|
||||
|
||||
/*************************************************************************
|
||||
* Mars::Mars(SGTime *t)
|
||||
* Mars::Mars(double mjd)
|
||||
* Public constructor for class Mars
|
||||
* Argument: The current time.
|
||||
* the hard coded orbital elements for Mars are passed to
|
||||
* CelestialBody::CelestialBody();
|
||||
************************************************************************/
|
||||
Mars::Mars(SGTime *t) :
|
||||
Mars::Mars(double mjd) :
|
||||
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, t)
|
||||
18.60210, 0.52402077660, mjd)
|
||||
{
|
||||
}
|
||||
Mars::Mars() :
|
||||
@ -55,14 +55,14 @@ Mars::Mars() :
|
||||
{
|
||||
}
|
||||
/*************************************************************************
|
||||
* void Mars::updatePosition(SGTime *t, Star *ourSun)
|
||||
* void Mars::updatePosition(double mjd, Star *ourSun)
|
||||
*
|
||||
* calculates the current position of Mars, by calling the base class,
|
||||
* CelestialBody::updatePosition(); The current magnitude is calculated using
|
||||
* a Mars specific equation
|
||||
*************************************************************************/
|
||||
void Mars::updatePosition(SGTime *t, Star *ourSun)
|
||||
void Mars::updatePosition(double mjd, Star *ourSun)
|
||||
{
|
||||
CelestialBody::updatePosition(t, ourSun);
|
||||
CelestialBody::updatePosition(mjd, ourSun);
|
||||
magnitude = -1.51 + 5*log10( r*R ) + 0.016 * FV;
|
||||
}
|
||||
|
@ -24,17 +24,15 @@
|
||||
#ifndef _MARS_HXX_
|
||||
#define _MARS_HXX_
|
||||
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include "celestialBody.hxx"
|
||||
#include "star.hxx"
|
||||
|
||||
class Mars : public CelestialBody
|
||||
{
|
||||
public:
|
||||
Mars ( SGTime *t);
|
||||
Mars ( double mjd );
|
||||
Mars ();
|
||||
void updatePosition(SGTime *t, Star *ourSun);
|
||||
void updatePosition(double mjd, Star *ourSun);
|
||||
};
|
||||
|
||||
#endif // _MARS_HXX_
|
||||
|
@ -30,19 +30,19 @@
|
||||
#include "mercury.hxx"
|
||||
|
||||
/*************************************************************************
|
||||
* Mercury::Mercury(SGTime *t)
|
||||
* Mercury::Mercury(double mjd)
|
||||
* Public constructor for class Mercury
|
||||
* Argument: The current time.
|
||||
* the hard coded orbital elements for Mercury are passed to
|
||||
* CelestialBody::CelestialBody();
|
||||
************************************************************************/
|
||||
Mercury::Mercury(SGTime *t) :
|
||||
Mercury::Mercury(double mjd) :
|
||||
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, t)
|
||||
168.6562, 4.09233443680, mjd)
|
||||
{
|
||||
}
|
||||
Mercury::Mercury() :
|
||||
@ -55,15 +55,15 @@ Mercury::Mercury() :
|
||||
{
|
||||
}
|
||||
/*************************************************************************
|
||||
* void Mercury::updatePosition(SGTime *t, Star *ourSun)
|
||||
* void Mercury::updatePosition(double mjd, Star *ourSun)
|
||||
*
|
||||
* calculates the current position of Mercury, by calling the base class,
|
||||
* CelestialBody::updatePosition(); The current magnitude is calculated using
|
||||
* a Mercury specific equation
|
||||
*************************************************************************/
|
||||
void Mercury::updatePosition(SGTime *t, Star *ourSun)
|
||||
void Mercury::updatePosition(double mjd, Star *ourSun)
|
||||
{
|
||||
CelestialBody::updatePosition(t, ourSun);
|
||||
CelestialBody::updatePosition(mjd, ourSun);
|
||||
magnitude = -0.36 + 5*log10( r*R ) + 0.027 * FV + 2.2E-13 * pow(FV, 6);
|
||||
}
|
||||
|
||||
|
@ -24,17 +24,15 @@
|
||||
#ifndef _MERCURY_HXX_
|
||||
#define _MERCURY_HXX_
|
||||
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include "celestialBody.hxx"
|
||||
#include "star.hxx"
|
||||
|
||||
class Mercury : public CelestialBody
|
||||
{
|
||||
public:
|
||||
Mercury ( SGTime *t);
|
||||
Mercury (double mjd);
|
||||
Mercury ();
|
||||
void updatePosition(SGTime *t, Star* ourSun);
|
||||
void updatePosition(double mjd, Star* ourSun);
|
||||
};
|
||||
|
||||
#endif // _MERURY_HXX_
|
||||
|
@ -39,20 +39,20 @@
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Moon::Moon(SGTime *t)
|
||||
* Moon::Moon(double mjd)
|
||||
* Public constructor for class Moon. Initializes the orbital elements and
|
||||
* sets up the moon texture.
|
||||
* Argument: The current time.
|
||||
* the hard coded orbital elements for Moon are passed to
|
||||
* CelestialBody::CelestialBody();
|
||||
************************************************************************/
|
||||
Moon::Moon(SGTime *t) :
|
||||
Moon::Moon(double mjd) :
|
||||
CelestialBody(125.1228, -0.0529538083,
|
||||
5.1454, 0.00000,
|
||||
318.0634, 0.1643573223,
|
||||
60.266600, 0.000000,
|
||||
0.054900, 0.000000,
|
||||
115.3654, 13.0649929509, t)
|
||||
115.3654, 13.0649929509, mjd)
|
||||
{
|
||||
}
|
||||
|
||||
@ -73,12 +73,12 @@ Moon::~Moon()
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* void Moon::updatePosition(SGTime *t, Star *ourSun)
|
||||
* void Moon::updatePosition(double mjd, Star *ourSun)
|
||||
* this member function calculates the actual topocentric position (i.e.)
|
||||
* the position of the moon as seen from the current position on the surface
|
||||
* of the moon.
|
||||
****************************************************************************/
|
||||
void Moon::updatePosition(SGTime *t, double lat, Star *ourSun)
|
||||
void Moon::updatePosition(double mjd, double lst, double lat, Star *ourSun)
|
||||
{
|
||||
double
|
||||
eccAnom, ecl, actTime,
|
||||
@ -86,8 +86,8 @@ void Moon::updatePosition(SGTime *t, double lat, Star *ourSun)
|
||||
Ls, Lm, D, F, mpar, gclat, rho, HA, g,
|
||||
geoRa, geoDec;
|
||||
|
||||
updateOrbElements(t);
|
||||
actTime = fgCalcActTime(t);
|
||||
updateOrbElements(mjd);
|
||||
actTime = fgCalcActTime(mjd);
|
||||
|
||||
// calculate the angle between ecliptic and equatorial coordinate system
|
||||
// in Radians
|
||||
@ -174,7 +174,7 @@ void Moon::updatePosition(SGTime *t, double lat, Star *ourSun)
|
||||
if (geoRa < 0)
|
||||
geoRa += (2*FG_PI);
|
||||
|
||||
HA = t->getLst() - (3.8197186 * geoRa);
|
||||
HA = lst - (3.8197186 * geoRa);
|
||||
/* FG_LOG( FG_GENERAL, FG_INFO, "t->getLst() = " << t->getLst()
|
||||
<< " HA = " << HA ); */
|
||||
|
||||
|
@ -26,7 +26,6 @@
|
||||
|
||||
|
||||
#include <simgear/constants.h>
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include "celestialBody.hxx"
|
||||
#include "star.hxx"
|
||||
@ -49,10 +48,10 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
Moon( SGTime *t);
|
||||
Moon(double mjd);
|
||||
Moon();
|
||||
~Moon();
|
||||
void updatePosition(SGTime *t, double lat, Star *ourSun);
|
||||
void updatePosition(double mjd, double lst, double lat, Star *ourSun);
|
||||
// void newImage();
|
||||
};
|
||||
|
||||
|
@ -30,19 +30,19 @@
|
||||
#include "neptune.hxx"
|
||||
|
||||
/*************************************************************************
|
||||
* Neptune::Neptune(SGTime *t)
|
||||
* Neptune::Neptune(double mjd)
|
||||
* Public constructor for class Neptune
|
||||
* Argument: The current time.
|
||||
* the hard coded orbital elements for Neptune are passed to
|
||||
* CelestialBody::CelestialBody();
|
||||
************************************************************************/
|
||||
Neptune::Neptune(SGTime *t) :
|
||||
Neptune::Neptune(double mjd) :
|
||||
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, t)
|
||||
260.2471, 0.00599514700, mjd)
|
||||
{
|
||||
}
|
||||
Neptune::Neptune() :
|
||||
@ -55,14 +55,14 @@ Neptune::Neptune() :
|
||||
{
|
||||
}
|
||||
/*************************************************************************
|
||||
* void Neptune::updatePosition(SGTime *t, Star *ourSun)
|
||||
* void Neptune::updatePosition(double mjd, Star *ourSun)
|
||||
*
|
||||
* calculates the current position of Neptune, by calling the base class,
|
||||
* CelestialBody::updatePosition(); The current magnitude is calculated using
|
||||
* a Neptune specific equation
|
||||
*************************************************************************/
|
||||
void Neptune::updatePosition(SGTime *t, Star *ourSun)
|
||||
void Neptune::updatePosition(double mjd, Star *ourSun)
|
||||
{
|
||||
CelestialBody::updatePosition(t, ourSun);
|
||||
CelestialBody::updatePosition(mjd, ourSun);
|
||||
magnitude = -6.90 + 5*log10 (r*R) + 0.001 *FV;
|
||||
}
|
||||
|
@ -24,17 +24,15 @@
|
||||
#ifndef _NEPTUNE_HXX_
|
||||
#define _NEPTUNE_HXX_
|
||||
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include "celestialBody.hxx"
|
||||
#include "star.hxx"
|
||||
|
||||
class Neptune : public CelestialBody
|
||||
{
|
||||
public:
|
||||
Neptune ( SGTime *t);
|
||||
Neptune (double mjd);
|
||||
Neptune ();
|
||||
void updatePosition(SGTime *t, Star *ourSun);
|
||||
void updatePosition(double mjd, Star *ourSun);
|
||||
};
|
||||
|
||||
#endif // _NEPTUNE_HXX_
|
||||
|
@ -24,13 +24,12 @@
|
||||
#ifndef _PLUTO_HXX_
|
||||
#define _PLUTO_HXX_
|
||||
|
||||
#include <Time/fg_time.hxx>
|
||||
#include "celestialBody.hxx"
|
||||
|
||||
class Pluto : public CelestialBody
|
||||
{
|
||||
public:
|
||||
Pluto ( FGTime *t);
|
||||
Pluto (double mjd);
|
||||
Pluto ();
|
||||
};
|
||||
|
||||
|
@ -30,19 +30,19 @@
|
||||
#include "saturn.hxx"
|
||||
|
||||
/*************************************************************************
|
||||
* Saturn::Saturn(SGTime *t)
|
||||
* Saturn::Saturn(double mjd)
|
||||
* Public constructor for class Saturn
|
||||
* Argument: The current time.
|
||||
* the hard coded orbital elements for Saturn are passed to
|
||||
* CelestialBody::CelestialBody();
|
||||
************************************************************************/
|
||||
Saturn::Saturn(SGTime *t) :
|
||||
Saturn::Saturn(double mjd) :
|
||||
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, t)
|
||||
316.9670, 0.03344422820, mjd)
|
||||
{
|
||||
}
|
||||
Saturn::Saturn() :
|
||||
@ -56,17 +56,17 @@ Saturn::Saturn() :
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* void Saturn::updatePosition(SGTime *t, Star *ourSun)
|
||||
* void Saturn::updatePosition(double mjd, Star *ourSun)
|
||||
*
|
||||
* calculates the current position of Saturn, by calling the base class,
|
||||
* CelestialBody::updatePosition(); The current magnitude is calculated using
|
||||
* a Saturn specific equation
|
||||
*************************************************************************/
|
||||
void Saturn::updatePosition(SGTime *t, Star *ourSun)
|
||||
void Saturn::updatePosition(double mjd, Star *ourSun)
|
||||
{
|
||||
CelestialBody::updatePosition(t, ourSun);
|
||||
CelestialBody::updatePosition(mjd, ourSun);
|
||||
|
||||
double actTime = fgCalcActTime(t);
|
||||
double actTime = fgCalcActTime(mjd);
|
||||
double ir = 0.4897394;
|
||||
double Nr = 2.9585076 + 6.6672E-7*actTime;
|
||||
double B = asin (sin(declination) * cos(ir) -
|
||||
|
@ -24,17 +24,15 @@
|
||||
#ifndef _SATURN_HXX_
|
||||
#define _SATURN_HXX_
|
||||
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include "celestialBody.hxx"
|
||||
#include "star.hxx"
|
||||
|
||||
class Saturn : public CelestialBody
|
||||
{
|
||||
public:
|
||||
Saturn ( SGTime *t);
|
||||
Saturn (double mjd);
|
||||
Saturn ();
|
||||
void updatePosition(SGTime *t, Star *ourSun);
|
||||
void updatePosition(double mjd, Star *ourSun);
|
||||
};
|
||||
|
||||
#endif // _SATURN_HXX_
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* Star::Star(SGTime *t)
|
||||
* Star::Star(double mjd)
|
||||
* Public constructor for class Star
|
||||
* Argument: The current time.
|
||||
* the hard coded orbital elements our sun are passed to
|
||||
@ -42,13 +42,13 @@
|
||||
* note that the word sun is avoided, in order to prevent some compilation
|
||||
* problems on sun systems
|
||||
************************************************************************/
|
||||
Star::Star(SGTime *t) :
|
||||
Star::Star(double mjd) :
|
||||
CelestialBody (0.000000, 0.0000000000,
|
||||
0.0000, 0.00000,
|
||||
282.9404, 4.7093500E-5,
|
||||
1.0000000, 0.000000,
|
||||
0.016709, -1.151E-9,
|
||||
356.0470, 0.98560025850, t)
|
||||
356.0470, 0.98560025850, mjd)
|
||||
{
|
||||
distance = 0.0;
|
||||
}
|
||||
@ -70,20 +70,20 @@ Star::~Star()
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
* void Star::updatePosition(SGTime *t, Star *ourSun)
|
||||
* void Star::updatePosition(double mjd, Star *ourSun)
|
||||
*
|
||||
* calculates the current position of our sun.
|
||||
*************************************************************************/
|
||||
void Star::updatePosition(SGTime *t)
|
||||
void Star::updatePosition(double mjd)
|
||||
{
|
||||
double
|
||||
actTime, eccAnom,
|
||||
xv, yv, v, r,
|
||||
xe, ye, ze, ecl;
|
||||
|
||||
updateOrbElements(t);
|
||||
updateOrbElements(mjd);
|
||||
|
||||
actTime = fgCalcActTime(t);
|
||||
actTime = fgCalcActTime(mjd);
|
||||
ecl = DEG_TO_RAD * (23.4393 - 3.563E-7 * actTime); // Angle in Radians
|
||||
eccAnom = fgCalcEccAnom(M, e); // Calculate the eccentric Anomaly (also known as solving Kepler's equation)
|
||||
|
||||
|
@ -38,10 +38,10 @@ private:
|
||||
|
||||
public:
|
||||
|
||||
Star (SGTime *t);
|
||||
Star (double mjd);
|
||||
Star ();
|
||||
~Star();
|
||||
void updatePosition(SGTime *t);
|
||||
void updatePosition(double mjd);
|
||||
double getM();
|
||||
double getw();
|
||||
double getxs();
|
||||
|
@ -31,25 +31,25 @@
|
||||
#endif
|
||||
|
||||
// Constructor
|
||||
FGStars::FGStars() {
|
||||
SGStarData::SGStarData() {
|
||||
}
|
||||
|
||||
FGStars::FGStars( FGPath path ) {
|
||||
SGStarData::SGStarData( FGPath path ) {
|
||||
data_path = FGPath( path );
|
||||
load();
|
||||
}
|
||||
|
||||
|
||||
// Destructor
|
||||
FGStars::~FGStars() {
|
||||
SGStarData::~SGStarData() {
|
||||
}
|
||||
|
||||
|
||||
bool FGStars::load() {
|
||||
bool SGStarData::load() {
|
||||
|
||||
// -dw- avoid local data > 32k error by dynamic allocation of the
|
||||
// array, problem for some compilers
|
||||
stars = new sgdVec3[FG_MAX_STARS];
|
||||
stars = new sgdVec3[SG_MAX_STARS];
|
||||
|
||||
// build the full path name to the stars data base file
|
||||
data_path.append( "stars" );
|
||||
@ -69,7 +69,7 @@ bool FGStars::load() {
|
||||
nstars = 0;
|
||||
|
||||
// read in each line of the file
|
||||
while ( ! in.eof() && nstars < FG_MAX_STARS ) {
|
||||
while ( ! in.eof() && nstars < SG_MAX_STARS ) {
|
||||
in >> skipcomment;
|
||||
|
||||
getline( in, name, ',' );
|
||||
|
@ -21,8 +21,8 @@
|
||||
// $Id$
|
||||
|
||||
|
||||
#ifndef _STARS_HXX
|
||||
#define _STARS_HXX
|
||||
#ifndef _SG_STARDATA_HXX
|
||||
#define _SG_STARDATA_HXX
|
||||
|
||||
|
||||
#include <plib/sg.h>
|
||||
@ -30,10 +30,10 @@
|
||||
#include <simgear/misc/fgpath.hxx>
|
||||
|
||||
|
||||
#define FG_MAX_STARS 850
|
||||
#define SG_MAX_STARS 850
|
||||
|
||||
|
||||
class FGStars {
|
||||
class SGStarData {
|
||||
|
||||
int nstars;
|
||||
sgdVec3 *stars;
|
||||
@ -43,11 +43,11 @@ class FGStars {
|
||||
public:
|
||||
|
||||
// Constructor
|
||||
FGStars();
|
||||
FGStars( FGPath path );
|
||||
SGStarData();
|
||||
SGStarData( FGPath path );
|
||||
|
||||
// Destructor
|
||||
~FGStars();
|
||||
~SGStarData();
|
||||
|
||||
// load the stars database
|
||||
bool load();
|
||||
@ -58,4 +58,4 @@ public:
|
||||
};
|
||||
|
||||
|
||||
#endif // _STARS_HXX
|
||||
#endif // _SG_STARDATA_HXX
|
||||
|
@ -30,19 +30,19 @@
|
||||
#include "uranus.hxx"
|
||||
|
||||
/*************************************************************************
|
||||
* Uranus::Uranus(SGTime *t)
|
||||
* Uranus::Uranus(double mjd)
|
||||
* Public constructor for class Uranus
|
||||
* Argument: The current time.
|
||||
* the hard coded orbital elements for Uranus are passed to
|
||||
* CelestialBody::CelestialBody();
|
||||
************************************************************************/
|
||||
Uranus::Uranus(SGTime *t) :
|
||||
Uranus::Uranus(double mjd) :
|
||||
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, t)
|
||||
142.5905, 0.01172580600, mjd)
|
||||
{
|
||||
}
|
||||
Uranus::Uranus() :
|
||||
@ -56,14 +56,14 @@ Uranus::Uranus() :
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* void Uranus::updatePosition(SGTime *t, Star *ourSun)
|
||||
* void Uranus::updatePosition(double mjd, Star *ourSun)
|
||||
*
|
||||
* calculates the current position of Uranus, by calling the base class,
|
||||
* CelestialBody::updatePosition(); The current magnitude is calculated using
|
||||
* a Uranus specific equation
|
||||
*************************************************************************/
|
||||
void Uranus::updatePosition(SGTime *t, Star *ourSun)
|
||||
void Uranus::updatePosition(double mjd, Star *ourSun)
|
||||
{
|
||||
CelestialBody::updatePosition(t, ourSun);
|
||||
CelestialBody::updatePosition(mjd, ourSun);
|
||||
magnitude = -7.15 + 5*log10( r*R) + 0.001 * FV;
|
||||
}
|
||||
|
@ -24,17 +24,15 @@
|
||||
#ifndef _URANUS_HXX_
|
||||
#define _URANUS_HXX_
|
||||
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include "celestialBody.hxx"
|
||||
#include "star.hxx"
|
||||
|
||||
class Uranus : public CelestialBody
|
||||
{
|
||||
public:
|
||||
Uranus ( SGTime *t);
|
||||
Uranus (double mjd);
|
||||
Uranus ();
|
||||
void updatePosition(SGTime *t, Star *ourSun);
|
||||
void updatePosition(double mjd, Star *ourSun);
|
||||
};
|
||||
|
||||
#endif // _URANUS_HXX_
|
||||
|
@ -30,19 +30,19 @@
|
||||
#include "venus.hxx"
|
||||
|
||||
/*************************************************************************
|
||||
* Venus::Venus(SGTime *t)
|
||||
* Venus::Venus(double mjd)
|
||||
* Public constructor for class Venus
|
||||
* Argument: The current time.
|
||||
* the hard coded orbital elements for Venus are passed to
|
||||
* CelestialBody::CelestialBody();
|
||||
************************************************************************/
|
||||
Venus::Venus(SGTime *t) :
|
||||
Venus::Venus(double mjd) :
|
||||
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, t)
|
||||
48.00520, 1.60213022440, mjd)
|
||||
{
|
||||
}
|
||||
Venus::Venus() :
|
||||
@ -56,14 +56,14 @@ Venus::Venus() :
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* void Venus::updatePosition(SGTime *t, Star *ourSun)
|
||||
* void Venus::updatePosition(double mjd, Star *ourSun)
|
||||
*
|
||||
* calculates the current position of Venus, by calling the base class,
|
||||
* CelestialBody::updatePosition(); The current magnitude is calculated using
|
||||
* a Venus specific equation
|
||||
*************************************************************************/
|
||||
void Venus::updatePosition(SGTime *t, Star *ourSun)
|
||||
void Venus::updatePosition(double mjd, Star *ourSun)
|
||||
{
|
||||
CelestialBody::updatePosition(t, ourSun);
|
||||
CelestialBody::updatePosition(mjd, ourSun);
|
||||
magnitude = -4.34 + 5*log10( r*R ) + 0.013 * FV + 4.2E-07 * pow(FV,3);
|
||||
}
|
||||
|
@ -24,17 +24,15 @@
|
||||
#ifndef _VENUS_HXX_
|
||||
#define _VENUS_HXX_
|
||||
|
||||
#include <simgear/timing/sg_time.hxx>
|
||||
|
||||
#include "celestialBody.hxx"
|
||||
#include "star.hxx"
|
||||
|
||||
class Venus : public CelestialBody
|
||||
{
|
||||
public:
|
||||
Venus ( SGTime *t);
|
||||
Venus (double mjd);
|
||||
Venus ();
|
||||
void updatePosition(SGTime *t, Star *ourSun);
|
||||
void updatePosition(double mjd, Star *ourSun);
|
||||
};
|
||||
|
||||
#endif // _VENUS_HXX_
|
||||
|
Loading…
Reference in New Issue
Block a user