Geocentric coordinates More...
#include <GeographicLib/Geocentric.hpp>
Public Member Functions | |
Geocentric (real a, real r) | |
void | Forward (real lat, real lon, real h, real &x, real &y, real &z) const throw () |
void | Reverse (real x, real y, real z, real &lat, real &lon, real &h) const throw () |
Math::real | MajorRadius () const throw () |
Math::real | InverseFlattening () const throw () |
Static Public Attributes | |
static const Geocentric | WGS84 |
Geocentric coordinates
Convert between geodetic coordinates latitude = lat, longitude = lon, height = h (measured vertically from the surface of the ellipsoid) to geocentric coordinates (x, y, z). The origin of geocentric coordinates is at the center of the earth. The z axis goes thru the north pole, lat = 90o. The x axis goes thru lat = 0, lon = 0. Geocentric coordinates are also known as earth centered, earth fixed (ECEF) coordinates.
The conversion from geographic to geocentric coordinates is straightforward. For the reverse transformation we use
Several changes have been made to ensure that the method returns accurate results for all finite inputs (even if h is infinite). See Geocentric coordinates for details.
The errors in these routines are close to round-off. Specifically, for points within 5000 km of the surface of the ellipsoid (either inside or outside the ellipsoid), the error is bounded by 7 nm for the WGS84 ellipsoid. See Geocentric coordinates for further information on the errors.
Definition at line 45 of file Geocentric.hpp.
GeographicLib::Geocentric::Geocentric | ( | real | a, | |
real | r | |||
) |
Constructor for a ellipsoid radius a (meters) and reciprocal flattening r. Setting r = 0 implies r = inf or flattening = 0 (i.e., a sphere). Negative r indicates a prolate spheroid. An exception is thrown if a is not positive.
Definition at line 21 of file Geocentric.cpp.
void GeographicLib::Geocentric::Forward | ( | real | lat, | |
real | lon, | |||
real | h, | |||
real & | x, | |||
real & | y, | |||
real & | z | |||
) | const throw () |
Convert from geodetic coordinates lat, lon (degrees), h (meters) to geocentric coordinates x, y, z (meters). lat should be in the range [-90, 90]; lon and lon0 should be in the range [-180, 360].
Definition at line 38 of file Geocentric.cpp.
References GeographicLib::Constants::degree().
void GeographicLib::Geocentric::Reverse | ( | real | x, | |
real | y, | |||
real | z, | |||
real & | lat, | |||
real & | lon, | |||
real & | h | |||
) | const throw () |
Convert from geocentric coordinates x, y, z (meters) to geodetic lat, lon (degrees), h (meters). In general there are multiple solutions and the result which minimizes the absolute value of h is returned. If there are still multiple solutions with different latitutes (applies only if z = 0), then the solution with lat > 0 is returned. If there are still multiple solutions with different longitudes (applies only if x = y = 0) then lon = 0 is returned. The value of h returned satisfies h >= - a (1 - e2) / sqrt(1 - e2 sin2lat). The value of lon returned is in the range [-180, 180).
Definition at line 53 of file Geocentric.cpp.
References GeographicLib::Math::cbrt(), GeographicLib::Constants::degree(), and GeographicLib::Math::hypot().
Math::real GeographicLib::Geocentric::MajorRadius | ( | ) | const throw () [inline] |
The major radius of the ellipsoid (meters). This is that value of a used in the constructor.
Definition at line 88 of file Geocentric.hpp.
Referenced by GeographicLib::LocalCartesian::MajorRadius().
Math::real GeographicLib::Geocentric::InverseFlattening | ( | ) | const throw () [inline] |
The inverse flattening of the ellipsoid. This is that value of r used in the constructor. A value of 0 is returned for a sphere (infinite inverse flattening).
Definition at line 95 of file Geocentric.hpp.
Referenced by GeographicLib::LocalCartesian::InverseFlattening().
const Geocentric GeographicLib::Geocentric::WGS84 [static] |
A global instantiation of Geocentric with the parameters for the WGS84 ellipsoid.
Definition at line 101 of file Geocentric.hpp.