celestialBody.hxx

00001 /**************************************************************************
00002  * celestialBody.hxx
00003  * Written by Durk Talsma. Originally started October 1997, for distribution  
00004  * with the FlightGear project. Version 2 was written in August and 
00005  * September 1998. This code is based upon algorithms and data kindly 
00006  * provided by Mr. Paul Schlyter. (pausch@saaf.se). 
00007  *
00008  * This library is free software; you can redistribute it and/or
00009  * modify it under the terms of the GNU Library General Public
00010  * License as published by the Free Software Foundation; either
00011  * version 2 of the License, or (at your option) any later version.
00012  *
00013  * This library is distributed in the hope that it will be useful,
00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00016  * Library General Public License for more details.
00017  *
00018  * You should have received a copy of the GNU General Public License
00019  * along with this program; if not, write to the Free Software
00020  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00021  *
00022  * $Id: celestialBody_8hxx-source.html,v 1.15 2007-12-17 15:36:46 curt Exp $
00023  **************************************************************************/
00024 
00025 
00026 #ifndef _CELESTIALBODY_H_
00027 #define _CELESTIALBODY_H_
00028 
00029 #ifndef __cplusplus
00030 # error This library requires C++
00031 #endif
00032 
00033 
00034 #include <simgear/constants.h>
00035 
00036 class Star;
00037 
00038 class CelestialBody
00039 {
00040 protected:              // make the data protected, in order to give the
00041                         //  inherited classes direct access to the data
00042   double NFirst;        /* longitude of the ascending node first part */
00043   double NSec;          /* longitude of the ascending node second part */
00044   double iFirst;        /* inclination to the ecliptic first part */
00045   double iSec;          /* inclination to the ecliptic second part */
00046   double wFirst;        /* first part of argument of perihelion */
00047   double wSec;          /* second part of argument of perihelion */
00048   double aFirst;        /* semimayor axis first part*/
00049   double aSec;          /* semimayor axis second part */
00050   double eFirst;        /* eccentricity first part */
00051   double eSec;          /* eccentricity second part */
00052   double MFirst;        /* Mean anomaly first part */
00053   double MSec;          /* Mean anomaly second part */
00054 
00055   double N, i, w, a, e, M; /* the resulting orbital elements, obtained from the former */
00056 
00057   double rightAscension, declination;
00058   double r, R, s, FV;
00059   double magnitude;
00060   double lonEcl, latEcl;
00061 
00062   double sgCalcEccAnom(double M, double e);
00063   double sgCalcActTime(double mjd);
00064   void updateOrbElements(double mjd);
00065 
00066 public:
00067   CelestialBody(double Nf, double Ns,
00068                 double If, double Is,
00069                 double wf, double ws,
00070                 double af, double as,
00071                 double ef, double es,
00072                 double Mf, double Ms, double mjd);
00073   CelestialBody(double Nf, double Ns,
00074                 double If, double Is,
00075                 double wf, double ws,
00076                 double af, double as,
00077                 double ef, double es,
00078                 double Mf, double Ms);
00079   void getPos(double *ra, double *dec);
00080   void getPos(double *ra, double *dec, double *magnitude);
00081   double getRightAscension();
00082   double getDeclination();
00083   double getMagnitude();
00084   double getLon();
00085   double getLat(); 
00086   void updatePosition(double mjd, Star *ourSun);
00087 };
00088 
00089 inline double CelestialBody::getRightAscension() { return rightAscension; }
00090 inline double CelestialBody::getDeclination() { return declination; }
00091 inline double CelestialBody::getMagnitude() { return magnitude; }
00092 
00093 inline double CelestialBody::getLon()
00094 {
00095   return lonEcl;
00096 }
00097 
00098 inline double CelestialBody::getLat()
00099 {
00100   return latEcl;
00101 }
00102 
00103 #endif // _CELESTIALBODY_H_
00104 

Generated on Mon Dec 17 09:30:54 2007 for SimGear by  doxygen 1.5.1