simgear/Astro/orbits.hxx

126 lines
3.8 KiB
C++
Raw Normal View History

/**************************************************************************
* orbits.h - calculates the orbital elements of the sun, moon and planets.
* For inclusion in flight gear
*
* Written 1997 by Durk Talsma, started October 19, 1997.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Id$
* (Log is kept at end of this file)
**************************************************************************/
1998-04-22 21:21:26 +08:00
#ifndef _ORBITS_HXX
#define _ORBITS_HXX
1998-04-22 21:21:26 +08:00
#ifndef __cplusplus
# error This library requires C++
1998-04-22 01:02:27 +08:00
#endif
#include <stdio.h>
#include <math.h>
#include <Time/fg_time.h>
//#define STANDARDEPOCH 2000
typedef struct {
double xs;
double ys;
1997-12-31 00:36:40 +08:00
double dist;
double lonSun;
} fgSUNPOS;
extern fgSUNPOS solarPosition;
struct OrbElements {
double NFirst; /* longitude of the ascending node first part */
double NSec; /* longitude of the ascending node second part */
double iFirst; /* inclination to the ecliptic first part */
double iSec; /* inclination to the ecliptic second part */
double wFirst; /* first part of argument of perihelion */
double wSec; /* second part of argument of perihelion */
double aFirst; /* semimayor axis first part*/
double aSec; /* semimayor axis second part */
double eFirst; /* eccentricity first part */
double eSec; /* eccentricity second part */
double MFirst; /* Mean anomaly first part */
double MSec; /* Mean anomaly second part */
double N, i, w, a, e, M; /* the resultant orbital elements, obtained from the former */
};
struct CelestialCoord {
double RightAscension;
double Declination;
double distance;
1997-12-31 00:36:40 +08:00
double magnitude;
};
double fgCalcEccAnom(double M, double e);
double fgCalcActTime(struct fgTIME t);
int fgReadOrbElements (struct OrbElements *dest, FILE * src);
int fgSolarSystemInit(struct fgTIME t);
void fgSolarSystemUpdate(struct OrbElements *planets, struct fgTIME t);
1998-04-22 21:21:26 +08:00
#endif /* _ORBITS_HXX */
/* $Log$
1998-04-22 21:21:26 +08:00
/* Revision 1.1 1998/04/22 13:21:30 curt
/* C++ - ifing the code a bit.
/*
1998-04-22 21:21:26 +08:00
* Revision 1.7 1998/04/21 17:02:31 curt
* Prepairing for C++ integration.
*
1998-04-22 01:02:27 +08:00
* Revision 1.6 1998/02/23 19:07:55 curt
* Incorporated Durk's Astro/ tweaks. Includes unifying the sun position
* calculation code between sun display, and other FG sections that use this
* for things like lighting.
*
* Revision 1.5 1998/02/12 21:59:35 curt
* Incorporated code changes contributed by Charlie Hotchkiss
* <chotchkiss@namg.us.anritsu.com>
*
* Revision 1.4 1998/02/02 20:53:22 curt
* To version 0.29
*
1998-02-03 04:52:20 +08:00
* Revision 1.3 1998/01/22 02:59:27 curt
* Changed #ifdef FILE_H to #ifdef _FILE_H
*
* Revision 1.2 1998/01/19 19:26:58 curt
* Merged in make system changes from Bob Kuehne <rpk@sgi.com>
* This should simplify things tremendously.
*
* Revision 1.1 1998/01/07 03:16:17 curt
* Moved from .../Src/Scenery/ to .../Src/Astro/
*
* Revision 1.2 1997/12/30 16:36:52 curt
* Merged in Durk's changes ...
*
1997-12-31 00:36:40 +08:00
* Revision 1.1 1997/10/25 03:16:10 curt
* Initial revision of code contributed by Durk Talsma.
*
*/