]> git.mxchange.org Git - simgear.git/blob - Scenery/orbits.h
Initial revision of code contributed by Durk Talsma.
[simgear.git] / Scenery / orbits.h
1 /**************************************************************************
2  * orbits.h - calculates the orbital elements of the sun, moon and planets.
3  *            For inclusion in flight gear
4  *
5  * Written 1997 by Durk Talsma, started October 19, 1997.
6  *
7  * This program is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License as
9  * published by the Free Software Foundation; either version 2 of the
10  * License, or (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  * $Id$
22  * (Log is kept at end of this file)
23  **************************************************************************/
24
25
26 #ifndef ORBITS_H
27 #define ORBITS_H
28
29
30 #include <stdio.h>
31 #include <math.h>
32
33 #include "../Time/fg_time.h"
34
35
36
37 #define STANDARDEPOCH 2000
38 #define PIOVER180       1.74532925199433E-002
39
40 struct SunPos {
41     double xs;
42     double ys;
43 };
44
45 struct OrbElements {
46     double NFirst;              /* longitude of the ascending node first part */
47     double NSec;                /* longitude of the ascending node second part */
48     double iFirst;              /* inclination to the ecliptic first part */
49     double iSec;                /* inclination to the ecliptic second part */
50     double wFirst;              /* first part of argument of perihelion */
51     double wSec;                /* second part of argument of perihelion */
52     double aFirst;              /* semimayor axis first part*/
53     double aSec;                /* semimayor axis second part */
54     double eFirst;              /* eccentricity first part */
55     double eSec;                /* eccentricity second part */
56     double MFirst;              /* Mean anomaly first part */
57     double MSec;                /* Mean anomaly second part */
58
59     double N, i, w, a, e, M;    /* the resultant orbital elements, obtained from the former */
60 };
61
62 struct CelestialCoord {
63     double RightAscension;
64     double Declination;
65     double distance;
66 };
67
68
69 double fgDegToRad(double angle);
70 double fgCalcEccAnom(double M, double e);
71 double fgCalcActTime(struct fgTIME t);
72
73 void fgReadOrbElements(struct OrbElements *dest, FILE *src);
74 void fgSolarSystemInit(struct fgTIME t);
75 void fgSolarSystemUpdate(struct OrbElements *planets, struct fgTIME t);
76
77
78 #endif /* ORBITS_H */
79
80
81 /* $Log$
82 /* Revision 1.1  1997/10/25 03:16:10  curt
83 /* Initial revision of code contributed by Durk Talsma.
84 /*
85  */