]> git.mxchange.org Git - flightgear.git/blob - Astro/orbits.hxx
C++ - ifing the code a bit.
[flightgear.git] / Astro / orbits.hxx
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_HXX
27 #define _ORBITS_HXX
28
29
30 #ifndef __cplusplus                                                          
31 # error This library requires C++
32 #endif                                   
33
34
35 #include <stdio.h>
36 #include <math.h>
37
38 #include <Time/fg_time.h>
39
40
41
42 //#define STANDARDEPOCH 2000
43
44 typedef struct {
45     double xs;
46     double ys;
47     double dist;
48     double lonSun;
49 } fgSUNPOS;
50
51 extern fgSUNPOS solarPosition;
52
53
54 struct OrbElements {
55     double NFirst;              /* longitude of the ascending node first part */
56     double NSec;                /* longitude of the ascending node second part */
57     double iFirst;              /* inclination to the ecliptic first part */
58     double iSec;                /* inclination to the ecliptic second part */
59     double wFirst;              /* first part of argument of perihelion */
60     double wSec;                /* second part of argument of perihelion */
61     double aFirst;              /* semimayor axis first part*/
62     double aSec;                /* semimayor axis second part */
63     double eFirst;              /* eccentricity first part */
64     double eSec;                /* eccentricity second part */
65     double MFirst;              /* Mean anomaly first part */
66     double MSec;                /* Mean anomaly second part */
67
68     double N, i, w, a, e, M;    /* the resultant orbital elements, obtained from the former */
69 };
70
71 struct CelestialCoord {
72     double RightAscension;
73     double Declination;
74     double distance;
75     double magnitude;
76 };
77
78
79 double fgCalcEccAnom(double M, double e);
80 double fgCalcActTime(struct fgTIME t);
81
82 int fgReadOrbElements (struct OrbElements *dest, FILE * src);
83 int  fgSolarSystemInit(struct fgTIME t);
84 void fgSolarSystemUpdate(struct OrbElements *planets, struct fgTIME t);
85
86
87 #endif /* _ORBITS_HXX */
88
89
90 /* $Log$
91 /* Revision 1.1  1998/04/22 13:21:30  curt
92 /* C++ - ifing the code a bit.
93 /*
94  * Revision 1.7  1998/04/21 17:02:31  curt
95  * Prepairing for C++ integration.
96  *
97  * Revision 1.6  1998/02/23 19:07:55  curt
98  * Incorporated Durk's Astro/ tweaks.  Includes unifying the sun position
99  * calculation code between sun display, and other FG sections that use this
100  * for things like lighting.
101  *
102  * Revision 1.5  1998/02/12 21:59:35  curt
103  * Incorporated code changes contributed by Charlie Hotchkiss
104  * <chotchkiss@namg.us.anritsu.com>
105  *
106  * Revision 1.4  1998/02/02 20:53:22  curt
107  * To version 0.29
108  *
109  * Revision 1.3  1998/01/22 02:59:27  curt
110  * Changed #ifdef FILE_H to #ifdef _FILE_H
111  *
112  * Revision 1.2  1998/01/19 19:26:58  curt
113  * Merged in make system changes from Bob Kuehne <rpk@sgi.com>
114  * This should simplify things tremendously.
115  *
116  * Revision 1.1  1998/01/07 03:16:17  curt
117  * Moved from .../Src/Scenery/ to .../Src/Astro/
118  *
119  * Revision 1.2  1997/12/30 16:36:52  curt
120  * Merged in Durk's changes ...
121  *
122  * Revision 1.1  1997/10/25 03:16:10  curt
123  * Initial revision of code contributed by Durk Talsma.
124  *
125  */