From 87e59ff8768bf09bd2aaa2d24cdd030cce414cd2 Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 24 Mar 2001 03:02:31 +0000 Subject: [PATCH] SG_ namespace fixes. --- simgear/constants.h | 6 +++--- simgear/inlines.h | 8 ++++---- simgear/math/polar3d.cxx | 4 ++-- simgear/math/sg_geodesy.cxx | 7 ++----- simgear/metar/MetarTest/MetarLibTest.cpp | 2 +- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/simgear/constants.h b/simgear/constants.h index 3558b121..a60a27fa 100644 --- a/simgear/constants.h +++ b/simgear/constants.h @@ -69,13 +69,13 @@ # define M_E 2.7182818284590452354 #endif -// ONE_SECOND is pi/180/60/60, or about 100 feet at earths' equator -#define ONE_SECOND 4.848136811E-6 +// SG_ONE_SECOND is pi/180/60/60, or about 100 feet at earths' equator +#define SG_ONE_SECOND 4.848136811E-6 // Radius of Earth in kilometers at the equator. Another source had // 6378.165 but this is probably close enough -#define EARTH_RAD 6378.155 +#define SG_EARTH_RAD 6378.155 // Earth parameters for WGS 84, taken from LaRCsim/ls_constants.h diff --git a/simgear/inlines.h b/simgear/inlines.h index 8cf00c1d..e3aae3c3 100644 --- a/simgear/inlines.h +++ b/simgear/inlines.h @@ -32,25 +32,25 @@ inline const int SG_SIGN(const T x) { } template -inline const T SG_MIN(const T a, const T b) { +inline const T SG_MIN2(const T a, const T b) { return a < b ? a : b; } // return the minimum of three values template inline const T SG_MIN3( const T a, const T b, const T c) { - return (a < b ? SG_MIN (a, c) : SG_MIN (b, c)); + return (a < b ? SG_MIN2 (a, c) : SG_MIN2 (b, c)); } template -inline const T SG_MAX(const T a, const T b) { +inline const T SG_MAX2(const T a, const T b) { return a > b ? a : b; } // return the maximum of three values template inline const T SG_MAX3 (const T a, const T b, const T c) { - return (a > b ? SG_MAX (a, c) : SG_MAX (b, c)); + return (a > b ? SG_MAX2 (a, c) : SG_MAX2 (b, c)); } // diff --git a/simgear/math/polar3d.cxx b/simgear/math/polar3d.cxx index b3c0fe60..be924029 100644 --- a/simgear/math/polar3d.cxx +++ b/simgear/math/polar3d.cxx @@ -42,8 +42,8 @@ double fgGeodAltFromCart(const Point3D& cp) lat_geoc = SGD_PI_2 - atan2( sqrt(cp.x()*cp.x() + cp.y()*cp.y()), cp.z() ); radius = sqrt( cp.x()*cp.x() + cp.y()*cp.y() + cp.z()*cp.z() ); - if( ( (SGD_PI_2 - lat_geoc) < ONE_SECOND ) // near North pole - || ( (SGD_PI_2 + lat_geoc) < ONE_SECOND ) ) // near South pole + if( ( (SGD_PI_2 - lat_geoc) < SG_ONE_SECOND ) // near North pole + || ( (SGD_PI_2 + lat_geoc) < SG_ONE_SECOND ) ) // near South pole { result = radius - EQUATORIAL_RADIUS_M*E; } else { diff --git a/simgear/math/sg_geodesy.cxx b/simgear/math/sg_geodesy.cxx index f26c0e93..d86f48e1 100644 --- a/simgear/math/sg_geodesy.cxx +++ b/simgear/math/sg_geodesy.cxx @@ -31,9 +31,6 @@ SG_USING_STD(cout); #endif -// ONE_SECOND is pi/180/60/60, or about 100 feet at earths' equator -#define ONE_SECOND 4.848136811E-6 - #define DOMAIN_ERR_DEBUG 1 @@ -60,8 +57,8 @@ void sgGeocToGeod( double lat_geoc, double radius, double double t_lat, x_alpha, mu_alpha, delt_mu, r_alpha, l_point, rho_alpha; double sin_mu_a, denom,delt_lambda, lambda_sl, sin_lambda_sl; - if( ( (SGD_PI_2 - lat_geoc) < ONE_SECOND ) // near North pole - || ( (SGD_PI_2 + lat_geoc) < ONE_SECOND ) ) // near South pole + if( ( (SGD_PI_2 - lat_geoc) < SG_ONE_SECOND ) // near North pole + || ( (SGD_PI_2 + lat_geoc) < SG_ONE_SECOND ) ) // near South pole { *lat_geod = lat_geoc; *sea_level_r = EQUATORIAL_RADIUS_M*E; diff --git a/simgear/metar/MetarTest/MetarLibTest.cpp b/simgear/metar/MetarTest/MetarLibTest.cpp index 81410d0e..6135ed18 100644 --- a/simgear/metar/MetarTest/MetarLibTest.cpp +++ b/simgear/metar/MetarTest/MetarLibTest.cpp @@ -468,7 +468,7 @@ display(void) CMetarStation::for_each( dispMetarStation ); glEnd(); glColor3d(0.0, 0.0, 1.0); - glutWireSphere(EARTH_RAD,32,16); + glutWireSphere(SG_EARTH_RAD,32,16); glutSwapBuffers(); ii++; glPopMatrix(); -- 2.39.5