// specified in radians. Distances are specified in meters.
inline Point3D sgCartToPolar3d(const Point3D& cp) {
return Point3D( atan2( cp.y(), cp.x() ),
- SG_PI_2 -
+ SGD_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()) );
}
// 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) ) );
} else {
result.setx(
fmod(orig.x() - asin( sin(course) * sin(dist) /
- cos(result.y()) ) + SG_PI, SG_2PI) - SG_PI );
+ cos(result.y()) )
+ + SGD_PI, SGD_2PI) - SGD_PI );
}
return result;
if ( cos(start.y()) < SG_EPSILON ) {
// EPS a small number ~ machine precision
if ( start.y() > 0 ) {
- tc1 = SG_PI; // starting from N pole
+ tc1 = SGD_PI; // starting from N pole
} else {
tc1 = 0; // starting from S pole
}
if ( sin( dest.x() - start.x() ) < 0 ) {
tc1 = tmp5;
} else {
- tc1 = 2 * SG_PI - tmp5;
+ tc1 = 2 * SGD_PI - tmp5;
}
*course = tc1;
- *dist = d * RAD_TO_NM * NM_TO_METER;
+ *dist = d * SG_RAD_TO_NM * SG_NM_TO_METER;
}
#endif // _POLAR_HXX