**************************************************************************/
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-
#include <math.h>
-#include <simgear/misc/fgpath.hxx>
+#include <simgear/misc/sg_path.hxx>
#include "newbucket.hxx"
// constructor for specified location
-inline SGBucket::SGBucket(const double dlon, const double dlat) {
+SGBucket::SGBucket(const double dlon, const double dlat) {
set_bucket(dlon, dlat);
}
// create an impossible bucket if false
-inline SGBucket::SGBucket(const bool is_good) {
+SGBucket::SGBucket(const bool is_good) {
set_bucket(0.0, 0.0);
if ( !is_good ) {
lon = -1000;
// Parse a unique scenery tile index and find the lon, lat, x, and y
-inline SGBucket::SGBucket(const long int bindex) {
+SGBucket::SGBucket(const long int bindex) {
long int index = bindex;
lon = index >> 14;
// default destructor
-inline SGBucket::~SGBucket() {
+SGBucket::~SGBucket() {
}
// 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
//
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;
hem, top_lon, pole, top_lat,
hem, main_lon, pole, main_lat);
- FGPath path( raw_path );
+ SGPath path( raw_path );
return path.str();
}
} else {
clat = (int)clat - 0.5;
}
- double clat_rad = clat * DEG_TO_RAD;
+ double clat_rad = clat * SGD_DEGREES_TO_RADIANS;
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_radius = cos_lat * SG_EQUATORIAL_RADIUS_M;
+ double local_perimeter = 2.0 * local_radius * SGD_PI;
double degree_width = local_perimeter / 360.0;
return sg_bucket_span( get_center_lat() ) * degree_width;
// 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 * SG_EQUATORIAL_RADIUS_M * SGD_PI;
double degree_height = perimeter / 360.0;
return SG_BUCKET_SPAN * degree_height;