Geodesic calculations More...
#include <GeographicLib/Geodesic.hpp>
Public Member Functions | |
Geodesic (double a, double invf) throw () | |
void | Direct (double lat1, double lon1, double azi1, double s12, double &lat2, double &lon2, double &azi2) const throw () |
GeodesicLine | Line (double lat1, double lon1, double azi1) const throw () |
void | Inverse (double lat1, double lon1, double lat2, double lon2, double &s12, double &azi1, double &azi2) const throw () |
Static Public Attributes | |
static const Geodesic | WGS84 |
Friends | |
class | GeodesicLine |
Geodesic calculations
The shortest path between two points on the ellipsoid at (lat1, lon1) and (lat2, lon2) is called the geodesic. Its length is s12 and the geodesic from point 1 to point 2 has azimuths azi1 and azi2 at the two end points. (The azimuth is the heading measured clockwise from north. azi2 is the "forward" azimuth, i.e., the heading that takes you beyond point 2 not back to point 1.)
Given lat1, lon1, azi1, and s12, we can determine lat2, lon2, azi2. This is the direct geodesic problem. (If s12 is sufficiently large that the geodesic wraps more than halfway around the earth, there will be a true geodesic between the points with a smaller s12.)
Given lat1, lon1, lat2, and lon2, we can determine azi1, azi2, s12. This is the inverse geodesic problem. Usually, the solution to the inverse problem is unique. In cases where there are muliple solutions (all with the same s12, of course), all the solutions can be easily generated once a particular solution is provided.
The calculations are accurate to better than 12 nm. (See Accuracy of geodesic calculation for details.)
GeographicLib::Geodesic::Geodesic | ( | 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 48 of file Geodesic.cpp.
void GeographicLib::Geodesic::Direct | ( | double | lat1, |
double | lon1, | ||
double | azi1, | ||
double | s12, | ||
double & | lat2, | ||
double & | lon2, | ||
double & | azi2 | ||
) | const throw () |
Perform the direct geodesic calculation. Given a latitude, lat1, longitude, lon1, and azimuth azi1 (in degrees) for point 1 and a range, s12 (in meters) from point 1 to point 2, return the latitude, lat2, longitude, lon2, and forward azimuth, azi2 (in degees) for point 2.
Definition at line 247 of file Geodesic.cpp.
References GeographicLib::GeodesicLine::Position().
Referenced by main().
GeodesicLine GeographicLib::Geodesic::Line | ( | double | lat1, |
double | lon1, | ||
double | azi1 | ||
) | const throw () |
Set up to do a series of ranges. This returns a GeodesicLine object with point 1 given by latitude, lat1, longitude, lon1, and azimuth azi1 (in degrees). Calls to GeodesicLine::Position return the position and azimuth for point 2 a specified distance away. Using GeodesicLine::Position is approximately 2.5 faster than calling Geodesic::Direct.
Definition at line 242 of file Geodesic.cpp.
Referenced by main().
void GeographicLib::Geodesic::Inverse | ( | double | lat1, |
double | lon1, | ||
double | lat2, | ||
double | lon2, | ||
double & | s12, | ||
double & | azi1, | ||
double & | azi2 | ||
) | const throw () |
Perform the inverse geodesic calculation. Given a latitude, lat1, longitude, lon1, for point 1 and a latitude, lat2, longitude, lon2, for point 2 (all in degrees), return the geodesic distance, s12 (in meters), and the forward azimuths, azi1 and azi2 (in degrees), at points 1 and 2.
Definition at line 254 of file Geodesic.cpp.
References GeographicLib::Constants::degree(), and GeographicLib::Constants::pi().
Referenced by main().
friend class GeodesicLine [friend] |
Definition at line 46 of file Geodesic.hpp.
const Geodesic GeographicLib::Geodesic::WGS84 [static] |
A global instantiation of Geodesic with the parameters for the WGS84 ellipsoid.
Definition at line 143 of file Geodesic.hpp.