1 /**************************************************************************
3 * Written by Durk Talsma. Originally started October 1997, for distribution
4 * with the FlightGear project. Version 2 was written in August and
5 * September 1998. This code is based upon algorithms and data kindly
6 * provided by Mr. Paul Schlyter. (pausch@saaf.se).
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 **************************************************************************/
27 #ifndef _CELESTIALBODY_H_
28 #define _CELESTIALBODY_H_
31 # error This library requires C++
35 #include <simgear/constants.h>
41 protected: // make the data protected, in order to give the
42 // inherited classes direct access to the data
43 double NFirst; /* longitude of the ascending node first part */
44 double NSec; /* longitude of the ascending node second part */
45 double iFirst; /* inclination to the ecliptic first part */
46 double iSec; /* inclination to the ecliptic second part */
47 double wFirst; /* first part of argument of perihelion */
48 double wSec; /* second part of argument of perihelion */
49 double aFirst; /* semimayor axis first part*/
50 double aSec; /* semimayor axis second part */
51 double eFirst; /* eccentricity first part */
52 double eSec; /* eccentricity second part */
53 double MFirst; /* Mean anomaly first part */
54 double MSec; /* Mean anomaly second part */
56 double N, i, w, a, e, M; /* the resulting orbital elements, obtained from the former */
58 double rightAscension, declination;
61 double lonEcl, latEcl;
63 double sgCalcEccAnom(double M, double e);
64 double sgCalcActTime(double mjd);
65 void updateOrbElements(double mjd);
68 CelestialBody(double Nf, double Ns,
73 double Mf, double Ms, double mjd);
74 CelestialBody(double Nf, double Ns,
79 double Mf, double Ms);
80 void getPos(double *ra, double *dec);
81 void getPos(double *ra, double *dec, double *magnitude);
82 double getRightAscension();
83 double getDeclination();
84 double getMagnitude();
87 void updatePosition(double mjd, Star *ourSun);
90 inline double CelestialBody::getRightAscension() { return rightAscension; }
91 inline double CelestialBody::getDeclination() { return declination; }
92 inline double CelestialBody::getMagnitude() { return magnitude; }
94 inline double CelestialBody::getLon()
99 inline double CelestialBody::getLat()
104 #endif // _CELESTIALBODY_H_