// // C++ Interface: earth_geometry // // Description: set of constants that defines the geometry of the earth // // // Author: Nicolas PASCAL , (C) 2012 // // Copyright: See COPYING file that comes with this distribution // // #include "earth_geometry.h" double Earth::get_radius() { // if (isnan(lat)) return Earth::authalic_radius; // else { // // compute distance from center at the surface of an ellipsoid : http://en.wikipedia.org/wiki/Earth_radius#Radius_at_a_given_geodetic_latitude // double lat_rad = radians(lat); // double cos_lat = cos (lat_rad); // double cos_2_lat = cos_lat * cos_lat; // double sin_lat = sin (lat_rad); // double sin_2_lat = sin_lat * sin_lat; // double d1 = (Earth::WGS84::a4 * cos_2_lat) + (Earth::WGS84::b4 * sin_2_lat); // double d2 = (Earth::WGS84::a2 * cos_2_lat) + (Earth::WGS84::b2 * sin_2_lat); // return sqrt (d1 / d2); // } } double Earth::WGS84::get_N(double lat) { double p = sin(lat); double w = sqrt(1 - e2*p*p); return a/w; }