1 // fg_constants.h -- various constant definitions
3 // Written by Curtis Olson, started July 1997.
5 // Copyright (C) 1997 Curtis L. Olson - curt@flightgear.org
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.
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.
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.
24 #ifndef _FG_CONSTANTS_H
25 #define _FG_CONSTANTS_H
30 # error This library requires C++
39 #include "Include/compiler.h"
41 #ifdef FG_HAVE_STD_INCLUDES
44 # ifdef FG_MATH_EXCEPTION_CLASH
45 # define exception C_exception
50 // This should be defined via autoconf in configure.in
52 #define VERSION "\"not defined\""
56 // Make sure PI is defined in its various forms
58 // PI, only PI, and nothing but PI
62 # define FG_PI 3.14159265358979323846
66 #define FG_2PI 6.28318530717958647692
70 # define FG_PI_2 M_PI_2
72 # define FG_PI_2 1.57079632679489661923
76 #define FG_PI_4 0.78539816339744830961
79 # define M_E 2.7182818284590452354
82 // ONE_SECOND is pi/180/60/60, or about 100 feet at earths' equator
83 #define ONE_SECOND 4.848136811E-6
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
91 // Earth parameters for WGS 84, taken from LaRCsim/ls_constants.h
93 // Value of earth radius from [8]
94 #define EQUATORIAL_RADIUS_FT 20925650. // ft
95 #define EQUATORIAL_RADIUS_M 6378138.12 // meter
97 #define RESQ_FT 437882827922500. // ft
98 #define RESQ_M 40680645877797.1344 // meter
100 // Value of earth flattening parameter from ref [8]
104 // EPS = sqrt(1-(1-f)^2)
107 #define FP 0.003352813178
108 #define E 0.996647186
109 #define EPS 0.081819221
110 #define INVG 0.031080997
112 // Time Related Parameters
114 #define MJD0 2415020.0
115 #define J2000 (2451545.0 - MJD0)
116 #define SIDRATE .9972695677
121 // Degrees to Radians
122 #define DEG_TO_RAD 0.017453292 // deg*pi/180 = rad
124 // Radians to Degrees
125 #define RAD_TO_DEG 57.29577951 // rad*180/pi = deg
127 // Arc seconds to radians // (arcsec*pi)/(3600*180) = rad
128 #define ARCSEC_TO_RAD 4.84813681109535993589e-06
130 // Radians to arc seconds // (rad*3600*180)/pi = arcsec
131 #define RAD_TO_ARCSEC 206264.806247096355156
134 #define FEET_TO_METER 0.3048
137 #define METER_TO_FEET 3.28083989501312335958
139 // Meters to Nautical Miles, 1 nm = 6076.11549 feet
140 #define METER_TO_NM 0.00053995680
142 // Nautical Miles to Meters
143 #define NM_TO_METER 1852.0000
145 // Radians to Nautical Miles, 1 nm = 1/60 of a degree
146 #define NM_TO_RAD 0.00029088820866572159
148 // Nautical Miles to Radians
149 #define RAD_TO_NM 3437.7467707849392526
151 // For divide by zero avoidance, this will be close enough to zero
152 #define FG_EPSILON 0.0000001
155 // Timing constants for Flight Model updates
156 #define NEW_DEFAULT_MODEL_HZ 120
159 // Field of view limits
160 #define FG_FOV_MIN 0.1
161 #define FG_FOV_MAX 179.9
164 // Maximum nodes per tile
165 #define FG_MAX_NODES 2000
168 #endif // _FG_CONSTANTS_H