]> git.mxchange.org Git - flightgear.git/blob - src/Include/fg_constants.h
Set up the model view matrix exactly as ssg does it before drawing sky, stars
[flightgear.git] / src / Include / fg_constants.h
1 // fg_constants.h -- various constant definitions
2 //
3 // Written by Curtis Olson, started July 1997.
4 //
5 // Copyright (C) 1997  Curtis L. Olson  - curt@flightgear.org
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
23
24 #ifndef _FG_CONSTANTS_H
25 #define _FG_CONSTANTS_H
26
27
28 /*
29 #ifndef __cplusplus                                                          
30 # error This library requires C++
31 #endif                                   
32 */
33
34
35 #ifdef HAVE_CONFIG_H
36 #  include <config.h>
37 #endif
38
39 #include "Include/compiler.h"
40
41 #ifdef FG_HAVE_STD_INCLUDES
42 #  include <cmath>
43 #else
44 #  ifdef FG_MATH_EXCEPTION_CLASH
45 #    define exception C_exception
46 #  endif
47 #  include <math.h>
48 #endif
49
50 // This should be defined via autoconf in configure.in
51 #ifndef VERSION
52 #define VERSION "\"not defined\""
53 #endif
54
55
56 // Make sure PI is defined in its various forms
57
58 // PI, only PI, and nothing but PI
59 #ifdef M_PI
60 #  define  FG_PI    M_PI
61 #else
62 #  define  FG_PI    3.14159265358979323846
63 #endif
64
65 // 2 * PI
66 #define FG_2PI      6.28318530717958647692
67
68 // PI / 2
69 #ifdef M_PI_2
70 #  define  FG_PI_2  M_PI_2
71 #else
72 #  define  FG_PI_2  1.57079632679489661923
73 #endif
74
75 // PI / 4
76 #define FG_PI_4     0.78539816339744830961
77
78 #ifndef M_E
79 #  define M_E     2.7182818284590452354
80 #endif
81
82 // ONE_SECOND is pi/180/60/60, or about 100 feet at earths' equator
83 #define ONE_SECOND 4.848136811E-6
84
85
86 // Radius of Earth in kilometers at the equator.  Another source had
87 // 6378.165 but this is probably close enough
88 #define EARTH_RAD 6378.155
89
90
91 // Earth parameters for WGS 84, taken from LaRCsim/ls_constants.h
92
93 // Value of earth radius from [8]
94 #define EQUATORIAL_RADIUS_FT 20925650.    // ft
95 #define EQUATORIAL_RADIUS_M   6378138.12  // meter
96 // Radius squared
97 #define RESQ_FT 437882827922500.          // ft
98 #define RESQ_M   40680645877797.1344      // meter
99
100 // Value of earth flattening parameter from ref [8] 
101 //
102 //      Note: FP = f
103 //            E  = 1-f
104 //            EPS = sqrt(1-(1-f)^2)
105 //
106               
107 #define FP    0.003352813178
108 #define E     0.996647186
109 #define EPS   0.081819221
110 #define INVG  0.031080997
111
112 // Time Related Parameters
113
114 #define MJD0  2415020.0
115 #define J2000 (2451545.0 - MJD0)
116 #define SIDRATE         .9972695677
117
118
119 // Conversions
120
121 // Degrees to Radians
122 #define DEG_TO_RAD       0.017453292          // deg*pi/180 = rad
123
124 // Radians to Degrees
125 #define RAD_TO_DEG       57.29577951          // rad*180/pi = deg
126
127 // Arc seconds to radians                     // (arcsec*pi)/(3600*180) = rad
128 #define ARCSEC_TO_RAD    4.84813681109535993589e-06 
129
130 // Radians to arc seconds                     // (rad*3600*180)/pi = arcsec
131 #define RAD_TO_ARCSEC    206264.806247096355156
132
133 // Feet to Meters
134 #define FEET_TO_METER    0.3048
135
136 // Meters to Feet
137 #define METER_TO_FEET    3.28083989501312335958  
138
139 // Meters to Nautical Miles, 1 nm = 6076.11549 feet
140 #define METER_TO_NM      0.00053995680
141
142 // Nautical Miles to Meters
143 #define NM_TO_METER      1852.0000
144
145 // Radians to Nautical Miles, 1 nm = 1/60 of a degree
146 #define NM_TO_RAD        0.00029088820866572159
147
148 // Nautical Miles to Radians
149 #define RAD_TO_NM        3437.7467707849392526
150
151 // For divide by zero avoidance, this will be close enough to zero
152 #define FG_EPSILON 0.0000001
153
154
155 // Timing constants for Flight Model updates
156 #define DEFAULT_TIMER_HZ 20
157 #define DEFAULT_MULTILOOP 6
158 #define DEFAULT_MODEL_HZ (DEFAULT_TIMER_HZ * DEFAULT_MULTILOOP)
159
160
161 // Field of view limits
162 #define FG_FOV_MIN 0.1
163 #define FG_FOV_MAX 179.9
164
165
166 // Maximum nodes per tile
167 #define FG_MAX_NODES 2000
168
169
170 #endif // _FG_CONSTANTS_H
171
172