From: curt Date: Fri, 23 Mar 2001 23:18:08 +0000 (+0000) Subject: FG_ to SG_ namespace changes. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=470d01a50881e36f49f15549263623f965e2c452;p=simgear.git FG_ to SG_ namespace changes. --- diff --git a/simgear/bucket/newbucket.cxx b/simgear/bucket/newbucket.cxx index e2b334fa..8e334d8d 100644 --- a/simgear/bucket/newbucket.cxx +++ b/simgear/bucket/newbucket.cxx @@ -96,21 +96,21 @@ void SGBucket::set_bucket( double dlon, double dlat ) { // cout << "diff = " << diff << " span = " << span << endl; - if ( (dlon >= 0) || (fabs(diff) < FG_EPSILON) ) { + if ( (dlon >= 0) || (fabs(diff) < SG_EPSILON) ) { lon = (int)dlon; } else { lon = (int)dlon - 1; } // find subdivision or super lon if needed - if ( span < FG_EPSILON ) { + if ( span < SG_EPSILON ) { // polar cap lon = 0; x = 0; } else if ( span <= 1.0 ) { x = (int)((dlon - lon) / span); } else { - if ( (dlon >= 0) || (fabs(diff) < FG_EPSILON) ) { + if ( (dlon >= 0) || (fabs(diff) < SG_EPSILON) ) { lon = (int)( (int)(lon / span) * span); } else { // cout << " lon = " << lon @@ -128,7 +128,7 @@ void SGBucket::set_bucket( double dlon, double dlat ) { // diff = dlat - (double)(int)dlat; - if ( (dlat >= 0) || (fabs(diff) < FG_EPSILON) ) { + if ( (dlat >= 0) || (fabs(diff) < SG_EPSILON) ) { lat = (int)dlat; } else { lat = (int)dlat - 1; @@ -209,7 +209,7 @@ double SGBucket::get_width_m() const { double clat_rad = clat * DEG_TO_RAD; double cos_lat = cos( clat_rad ); double local_radius = cos_lat * EQUATORIAL_RADIUS_M; - double local_perimeter = 2.0 * local_radius * FG_PI; + double local_perimeter = 2.0 * local_radius * SG_PI; double degree_width = local_perimeter / 360.0; return sg_bucket_span( get_center_lat() ) * degree_width; @@ -218,7 +218,7 @@ double SGBucket::get_width_m() const { // return height of the tile in meters double SGBucket::get_height_m() const { - double perimeter = 2.0 * EQUATORIAL_RADIUS_M * FG_PI; + double perimeter = 2.0 * EQUATORIAL_RADIUS_M * SG_PI; double degree_height = perimeter / 360.0; return SG_BUCKET_SPAN * degree_height; diff --git a/simgear/compiler.h b/simgear/compiler.h index e77233e7..7edc7a8f 100644 --- a/simgear/compiler.h +++ b/simgear/compiler.h @@ -22,7 +22,9 @@ /** \file compiler.h * A set of defines to encapsulate compiler and platform differences. - * What this file does. + * Please refer to the source code for full documentation on this file. + * + * Here is a summary of what this file does. * * (1) Defines macros for some STL includes which may be affected * by file name length limitations. diff --git a/simgear/constants.h b/simgear/constants.h index 4dd597e7..f6d73d7a 100644 --- a/simgear/constants.h +++ b/simgear/constants.h @@ -21,6 +21,10 @@ // // $Id$ +/** \file constants.h + * Various constant definitions. + */ + #ifndef _SG_CONSTANTS_H #define _SG_CONSTANTS_H @@ -46,23 +50,23 @@ // PI, only PI, and nothing but PI #ifdef M_PI -# define FG_PI M_PI +# define SG_PI M_PI #else -# define FG_PI 3.14159265358979323846 +# define SG_PI 3.14159265358979323846 #endif // 2 * PI -#define FG_2PI 6.28318530717958647692 +#define SG_2PI 6.28318530717958647692 // PI / 2 #ifdef M_PI_2 -# define FG_PI_2 M_PI_2 +# define SG_PI_2 M_PI_2 #else -# define FG_PI_2 1.57079632679489661923 +# define SG_PI_2 1.57079632679489661923 #endif // PI / 4 -#define FG_PI_4 0.78539816339744830961 +#define SG_PI_4 0.78539816339744830961 #ifndef M_E # define M_E 2.7182818284590452354 @@ -139,7 +143,7 @@ #define RAD_TO_NM 3437.7467707849392526 // For divide by zero avoidance, this will be close enough to zero -#define FG_EPSILON 0.0000001 +#define SG_EPSILON 0.0000001 // Highest binobj format version we know how to read/write. This starts at diff --git a/simgear/ephemeris/moonpos.cxx b/simgear/ephemeris/moonpos.cxx index c0fb5753..07c4e790 100644 --- a/simgear/ephemeris/moonpos.cxx +++ b/simgear/ephemeris/moonpos.cxx @@ -173,7 +173,7 @@ void MoonPos::updatePosition(double mjd, double lst, double lat, Star *ourSun) // FG_LOG( FG_GENERAL, FG_INFO, "rho = " << rho ); if (geoRa < 0) - geoRa += (2*FG_PI); + geoRa += (2*SG_PI); HA = lst - (3.8197186 * geoRa); /* FG_LOG( FG_GENERAL, FG_INFO, "t->getLst() = " << t->getLst() diff --git a/simgear/math/polar3d.cxx b/simgear/math/polar3d.cxx index d071f1a7..7a36e96d 100644 --- a/simgear/math/polar3d.cxx +++ b/simgear/math/polar3d.cxx @@ -39,11 +39,11 @@ double fgGeodAltFromCart(const Point3D& cp) double lat_geoc, radius; double result; - lat_geoc = FG_PI_2 - atan2( sqrt(cp.x()*cp.x() + cp.y()*cp.y()), cp.z() ); + lat_geoc = SG_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( ( (FG_PI_2 - lat_geoc) < ONE_SECOND ) // near North pole - || ( (FG_PI_2 + lat_geoc) < ONE_SECOND ) ) // near South pole + if( ( (SG_PI_2 - lat_geoc) < ONE_SECOND ) // near North pole + || ( (SG_PI_2 + lat_geoc) < ONE_SECOND ) ) // near South pole { result = radius - EQUATORIAL_RADIUS_M*E; } else { diff --git a/simgear/math/polar3d.hxx b/simgear/math/polar3d.hxx index acd24ae7..6458cc1d 100644 --- a/simgear/math/polar3d.hxx +++ b/simgear/math/polar3d.hxx @@ -59,7 +59,7 @@ inline Point3D sgPolarToCart3d(const Point3D& p) { // specified in radians. Distances are specified in meters. inline Point3D sgCartToPolar3d(const Point3D& cp) { return Point3D( atan2( cp.y(), cp.x() ), - FG_PI_2 - + SG_PI_2 - atan2( sqrt(cp.x()*cp.x() + cp.y()*cp.y()), cp.z() ), sqrt(cp.x()*cp.x() + cp.y()*cp.y() + cp.z()*cp.z()) ); } @@ -88,12 +88,12 @@ inline Point3D calc_gc_lon_lat( const Point3D& orig, double course, result.sety( asin( sin(orig.y()) * cos(dist) + cos(orig.y()) * sin(dist) * cos(course) ) ); - if ( cos(result.y()) < FG_EPSILON ) { + if ( cos(result.y()) < SG_EPSILON ) { result.setx( orig.x() ); // endpoint a pole } else { result.setx( fmod(orig.x() - asin( sin(course) * sin(dist) / - cos(result.y()) ) + FG_PI, FG_2PI) - FG_PI ); + cos(result.y()) ) + SG_PI, SG_2PI) - SG_PI ); } return result; @@ -132,10 +132,10 @@ inline void calc_gc_course_dist( const Point3D& start, const Point3D& dest, double tc1; - if ( cos(start.y()) < FG_EPSILON ) { + if ( cos(start.y()) < SG_EPSILON ) { // EPS a small number ~ machine precision if ( start.y() > 0 ) { - tc1 = FG_PI; // starting from N pole + tc1 = SG_PI; // starting from N pole } else { tc1 = 0; // starting from S pole } @@ -149,7 +149,7 @@ inline void calc_gc_course_dist( const Point3D& start, const Point3D& dest, if ( sin( dest.x() - start.x() ) < 0 ) { tc1 = tmp5; } else { - tc1 = 2 * FG_PI - tmp5; + tc1 = 2 * SG_PI - tmp5; } *course = tc1; diff --git a/simgear/math/sg_geodesy.cxx b/simgear/math/sg_geodesy.cxx index c2a2e0f4..8969d713 100644 --- a/simgear/math/sg_geodesy.cxx +++ b/simgear/math/sg_geodesy.cxx @@ -60,8 +60,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( ( (FG_PI_2 - lat_geoc) < ONE_SECOND ) // near North pole - || ( (FG_PI_2 + lat_geoc) < ONE_SECOND ) ) // near South pole + if( ( (SG_PI_2 - lat_geoc) < ONE_SECOND ) // near North pole + || ( (SG_PI_2 + lat_geoc) < ONE_SECOND ) ) // near South pole { *lat_geod = lat_geoc; *sea_level_r = EQUATORIAL_RADIUS_M*E; @@ -180,7 +180,7 @@ void sgGeodToGeoc( double lat_geod, double alt, double *sl_radius, // // modified for FlightGear to use WGS84 only -- Norman Vine -#define GEOD_INV_PI FG_PI +#define GEOD_INV_PI SG_PI // s == distance // az = azimuth diff --git a/simgear/misc/texcoord.cxx b/simgear/misc/texcoord.cxx index e9a5ff80..f428cc92 100644 --- a/simgear/misc/texcoord.cxx +++ b/simgear/misc/texcoord.cxx @@ -181,7 +181,7 @@ point_list calc_tex_coords( const SGBucket& b, const point_list& geod_nodes, double clat_rad = clat * DEG_TO_RAD; double cos_lat = cos( clat_rad ); double local_radius = cos_lat * EQUATORIAL_RADIUS_M; - double local_perimeter = 2.0 * local_radius * FG_PI; + double local_perimeter = 2.0 * local_radius * SG_PI; double degree_width = local_perimeter / 360.0; // cout << "clat = " << clat << endl; @@ -191,7 +191,7 @@ point_list calc_tex_coords( const SGBucket& b, const point_list& geod_nodes, // cout << "local_perimeter = " << local_perimeter << endl; // cout << "degree_width = " << degree_width << endl; - double perimeter = 2.0 * EQUATORIAL_RADIUS_M * FG_PI; + double perimeter = 2.0 * EQUATORIAL_RADIUS_M * SG_PI; double degree_height = perimeter / 360.0; // cout << "degree_height = " << degree_height << endl; @@ -323,10 +323,10 @@ point_list calc_tex_coords( const SGBucket& b, const point_list& geod_nodes, // cout << "adjusted_t " << adjusted_t << endl; } #endif - if ( adjusted_t.x() < FG_EPSILON ) { + if ( adjusted_t.x() < SG_EPSILON ) { adjusted_t.setx( 0.0 ); } - if ( adjusted_t.y() < FG_EPSILON ) { + if ( adjusted_t.y() < SG_EPSILON ) { adjusted_t.sety( 0.0 ); } adjusted_t.setz( 0.0 );