Public Member Functions | Static Public Attributes
GeographicLib::Geocentric Class Reference

Geocentric coordinates More...

#include <GeographicLib/Geocentric.hpp>

List of all members.

Public Member Functions

 Geocentric (double a, double invf) throw ()
void Forward (double lat, double lon, double h, double &x, double &y, double &z) const throw ()
void Reverse (double x, double y, double z, double &lat, double &lon, double &h) const throw ()

Static Public Attributes

static const Geocentric WGS84

Detailed Description

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.


Constructor & Destructor Documentation

GeographicLib::Geocentric::Geocentric ( double  a,
double  invf 
) throw ()

Constructor for a ellipsoid radius a (meters) and inverse flattening invf. Setting invf <= 0 implies invf = inf or flattening = 0 (i.e., a sphere).

Definition at line 23 of file Geocentric.cpp.


Member Function Documentation

void GeographicLib::Geocentric::Forward ( double  lat,
double  lon,
double  h,
double &  x,
double &  y,
double &  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 36 of file Geocentric.cpp.

References GeographicLib::Constants::degree().

Referenced by main().

void GeographicLib::Geocentric::Reverse ( double  x,
double  y,
double  z,
double &  lat,
double &  lon,
double &  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 49 of file Geocentric.cpp.

References GeographicLib::Constants::pi(), and GeographicLib::Constants::degree().

Referenced by main().


Member Data Documentation

A global instantiation of Geocentric with the parameters for the WGS84 ellipsoid.

Definition at line 97 of file Geocentric.hpp.


The documentation for this class was generated from the following files: