1998-01-07 03:16:15 +00:00
|
|
|
/**************************************************************************
|
|
|
|
* 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 13:21:26 +00:00
|
|
|
#ifndef _ORBITS_HXX
|
|
|
|
#define _ORBITS_HXX
|
1998-01-07 03:16:15 +00:00
|
|
|
|
|
|
|
|
1998-04-22 13:21:26 +00:00
|
|
|
#ifndef __cplusplus
|
|
|
|
# error This library requires C++
|
1998-04-21 17:02:27 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
|
1998-01-07 03:16:15 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
1998-01-19 19:26:51 +00:00
|
|
|
#include <Time/fg_time.h>
|
1998-01-07 03:16:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
1998-02-23 19:07:49 +00:00
|
|
|
//#define STANDARDEPOCH 2000
|
1998-01-07 03:16:15 +00:00
|
|
|
|
1998-02-23 19:07:49 +00:00
|
|
|
typedef struct {
|
1998-01-07 03:16:15 +00:00
|
|
|
double xs;
|
|
|
|
double ys;
|
|
|
|
double dist;
|
1998-02-23 19:07:49 +00:00
|
|
|
double lonSun;
|
|
|
|
} fgSUNPOS;
|
|
|
|
|
|
|
|
extern fgSUNPOS solarPosition;
|
|
|
|
|
1998-01-07 03:16:15 +00:00
|
|
|
|
|
|
|
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;
|
|
|
|
double magnitude;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
double fgCalcEccAnom(double M, double e);
|
|
|
|
double fgCalcActTime(struct fgTIME t);
|
|
|
|
|
1998-02-23 19:07:49 +00:00
|
|
|
int fgReadOrbElements (struct OrbElements *dest, FILE * src);
|
1998-02-12 21:58:27 +00:00
|
|
|
int fgSolarSystemInit(struct fgTIME t);
|
1998-01-07 03:16:15 +00:00
|
|
|
void fgSolarSystemUpdate(struct OrbElements *planets, struct fgTIME t);
|
|
|
|
|
|
|
|
|
1998-04-22 13:21:26 +00:00
|
|
|
#endif /* _ORBITS_HXX */
|
1998-01-07 03:16:15 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* $Log$
|
1998-04-22 13:21:26 +00:00
|
|
|
/* Revision 1.1 1998/04/22 13:21:30 curt
|
|
|
|
/* C++ - ifing the code a bit.
|
1998-01-07 03:16:15 +00:00
|
|
|
/*
|
1998-04-22 13:21:26 +00:00
|
|
|
* Revision 1.7 1998/04/21 17:02:31 curt
|
|
|
|
* Prepairing for C++ integration.
|
|
|
|
*
|
1998-04-21 17:02:27 +00: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.
|
|
|
|
*
|
1998-02-23 19:07:49 +00:00
|
|
|
* Revision 1.5 1998/02/12 21:59:35 curt
|
|
|
|
* Incorporated code changes contributed by Charlie Hotchkiss
|
|
|
|
* <chotchkiss@namg.us.anritsu.com>
|
|
|
|
*
|
1998-02-12 21:58:27 +00:00
|
|
|
* Revision 1.4 1998/02/02 20:53:22 curt
|
|
|
|
* To version 0.29
|
|
|
|
*
|
1998-02-02 20:52:20 +00:00
|
|
|
* Revision 1.3 1998/01/22 02:59:27 curt
|
|
|
|
* Changed #ifdef FILE_H to #ifdef _FILE_H
|
|
|
|
*
|
1998-01-22 02:59:23 +00:00
|
|
|
* 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.
|
|
|
|
*
|
1998-01-19 19:26:51 +00:00
|
|
|
* Revision 1.1 1998/01/07 03:16:17 curt
|
|
|
|
* Moved from .../Src/Scenery/ to .../Src/Astro/
|
|
|
|
*
|
1998-01-07 03:16:15 +00:00
|
|
|
* Revision 1.2 1997/12/30 16:36:52 curt
|
|
|
|
* Merged in Durk's changes ...
|
|
|
|
*
|
|
|
|
* Revision 1.1 1997/10/25 03:16:10 curt
|
|
|
|
* Initial revision of code contributed by Durk Talsma.
|
|
|
|
*
|
|
|
|
*/
|