From caaa35e5a7f1bcae598136d8eb9b6588531a87d0 Mon Sep 17 00:00:00 2001 From: curt Date: Sat, 24 Mar 2001 03:55:18 +0000 Subject: [PATCH] SG_ namespace. --- simgear/constants.h | 16 ++++++++-------- simgear/math/polar3d.hxx | 4 ++-- simgear/metar/MetarReport.cpp | 6 +++--- simgear/metar/MetarStation.cpp | 4 ++-- simgear/route/waytest.cxx | 8 ++++---- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/simgear/constants.h b/simgear/constants.h index 8c7cf304..12345c14 100644 --- a/simgear/constants.h +++ b/simgear/constants.h @@ -90,28 +90,28 @@ // Conversions // Arc seconds to radians // (arcsec*pi)/(3600*180) = rad -#define ARCSEC_TO_RAD 4.84813681109535993589e-06 +#define SG_ARCSEC_TO_RAD 4.84813681109535993589e-06 // Radians to arc seconds // (rad*3600*180)/pi = arcsec -#define RAD_TO_ARCSEC 206264.806247096355156 +#define SG_RAD_TO_ARCSEC 206264.806247096355156 // Feet to Meters -#define FEET_TO_METER 0.3048 +#define SG_FEET_TO_METER 0.3048 // Meters to Feet -#define METER_TO_FEET 3.28083989501312335958 +#define SG_METER_TO_FEET 3.28083989501312335958 // Meters to Nautical Miles, 1 nm = 6076.11549 feet -#define METER_TO_NM 0.00053995680 +#define SG_METER_TO_NM 0.00053995680 // Nautical Miles to Meters -#define NM_TO_METER 1852.0000 +#define SG_NM_TO_METER 1852.0000 // Radians to Nautical Miles, 1 nm = 1/60 of a degree -#define NM_TO_RAD 0.00029088820866572159 +#define SG_NM_TO_RAD 0.00029088820866572159 // Nautical Miles to Radians -#define RAD_TO_NM 3437.7467707849392526 +#define SG_RAD_TO_NM 3437.7467707849392526 // For divide by zero avoidance, this will be close enough to zero #define SG_EPSILON 0.0000001 diff --git a/simgear/math/polar3d.hxx b/simgear/math/polar3d.hxx index 0c91bd4f..fd305b48 100644 --- a/simgear/math/polar3d.hxx +++ b/simgear/math/polar3d.hxx @@ -83,7 +83,7 @@ inline Point3D calc_gc_lon_lat( const Point3D& orig, double course, // printf("calc_lon_lat() offset.theta = %.2f offset.dist = %.2f\n", // offset.theta, offset.dist); - dist *= METER_TO_NM * NM_TO_RAD; + dist *= SG_METER_TO_NM * SG_NM_TO_RAD; result.sety( asin( sin(orig.y()) * cos(dist) + cos(orig.y()) * sin(dist) * cos(course) ) ); @@ -154,7 +154,7 @@ inline void calc_gc_course_dist( const Point3D& start, const Point3D& dest, } *course = tc1; - *dist = d * RAD_TO_NM * NM_TO_METER; + *dist = d * SG_RAD_TO_NM * SG_NM_TO_METER; } #endif // _POLAR_HXX diff --git a/simgear/metar/MetarReport.cpp b/simgear/metar/MetarReport.cpp index 0938a685..a1227e88 100644 --- a/simgear/metar/MetarReport.cpp +++ b/simgear/metar/MetarReport.cpp @@ -216,17 +216,17 @@ int CMetarReport::VerticalVisibility() // Meters int CMetarReport::Ceiling() { - return FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->Ceiling; + return SG_FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->Ceiling; } int CMetarReport::EstimatedCeiling() { - return FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->Estimated_Ceiling; + return SG_FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->Estimated_Ceiling; } int CMetarReport::VariableSkyLayerHeight() { - return FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->VrbSkyLayerHgt; + return SG_FEET_TO_METER * ((Decoded_METAR *)m_DecodedReport)->VrbSkyLayerHgt; } int CMetarReport::SnowDepthInches() diff --git a/simgear/metar/MetarStation.cpp b/simgear/metar/MetarStation.cpp index 8aa9e1e7..8115df48 100644 --- a/simgear/metar/MetarStation.cpp +++ b/simgear/metar/MetarStation.cpp @@ -82,10 +82,10 @@ CMetarStation::CMetarStation( s = t; t = strchr( s, ';' ); *t = 0; t++; double ulongitude = decodeDMS( s ); s = t; t = strchr( s, ';' ); *t = 0; t++; - double altitude = atoi( s ) * FEET_TO_METER; + double altitude = atoi( s ) * SG_FEET_TO_METER; m_altitude = altitude; s = t; t = strchr( s, ';' ); *t = 0; t++; - double ualtitude = atoi( s ) * FEET_TO_METER; + double ualtitude = atoi( s ) * SG_FEET_TO_METER; Point3D p( longitude, latitude, altitude+SG_EQUATORIAL_RADIUS_M ); m_locationPolar = p; m_locationCart = sgPolarToCart3d( p ); diff --git a/simgear/route/waytest.cxx b/simgear/route/waytest.cxx index ec748697..e8825b8e 100644 --- a/simgear/route/waytest.cxx +++ b/simgear/route/waytest.cxx @@ -14,12 +14,12 @@ int main() { a1.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance ); cout << "Course to " << a1.get_id() << " is " << course << endl; - cout << "Distance to " << a1.get_id() << " is " << distance * METER_TO_NM + cout << "Distance to " << a1.get_id() << " is " << distance * SG_METER_TO_NM << endl; a2.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance ); cout << "Course to " << a2.get_id() << " is " << course << endl; - cout << "Distance to " << a2.get_id() << " is " << distance * METER_TO_NM + cout << "Distance to " << a2.get_id() << " is " << distance * SG_METER_TO_NM << endl; cout << endl; @@ -28,12 +28,12 @@ int main() { b1.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance ); cout << "Course to " << b1.get_id() << " is " << course << endl; - cout << "Distance to " << b1.get_id() << " is " << distance * METER_TO_NM + cout << "Distance to " << b1.get_id() << " is " << distance * SG_METER_TO_NM << endl; b2.CourseAndDistance( cur_lon, cur_lat, cur_alt, &course, &distance ); cout << "Course to " << b2.get_id() << " is " << course << endl; - cout << "Distance to " << b2.get_id() << " is " << distance * METER_TO_NM + cout << "Distance to " << b2.get_id() << " is " << distance * SG_METER_TO_NM << endl; cout << endl; -- 2.39.5