A geodesic line. More...
#include <GeographicLib/Geodesic.hpp>
Public Member Functions | |
GeodesicLine () throw () | |
void | Position (double s12, double &lat2, double &lon2, double &azi2) const throw () |
bool | Init () const throw () |
double | Latitude () const throw () |
double | Longitude () const throw () |
double | Azimuth () const throw () |
Friends | |
class | Geodesic |
A geodesic line.
GeodesicLine facilitates the determination of a series of points on a single geodesic. Geodesic.Line returns a GeodesicLine object with the geodesic defined by by lat1, lon1, and azi1. GeodesicLine.Position returns the lat2, lon2, and azi2 given s12. An example of use of this class is:
// Print positions on a geodesic going through latitude 30, // longitude 10 at azimuth 80. Points at intervals of 10km // in the range [-1000km, 1000km] are given. GeodesicLine line(Geodesic::WGS84.Line(30.0, 10.0, 80.0)); double step = 10e3; for (int s = -100; s <= 100; ++s) { double lat2, lon2, azi2; double s12 = s * step; line.Position(s12, lat2, lon2, azi2); cout << s12 << " " << lat2 << " " << lon2 << " " << azi2 << "\n"; }
The default copy constructor and assignment operators work with this class, so that, for example, the previous example could start
GeodesicLine line; line = Geodesic::WGS84.Line(30.0, 10.0, 80.0); ...
Similarly, a vector can be used to hold GeodesicLine objects.
The calculations are accurate to better than 12 nm. (See Accuracy of geodesic calculation for details.)
GeographicLib::GeodesicLine::GeodesicLine | ( | ) | throw () [inline] |
A default constructor. If GeodesicLine::Position is called on the resulting object, it returns immediately (without doing any calculations). The object should be set with a call to Geodesic::Line. Use Init() to test whether object is still in this uninitialized state.
Definition at line 202 of file Geodesic.hpp.
void GeographicLib::GeodesicLine::Position | ( | double | s12, |
double & | lat2, | ||
double & | lon2, | ||
double & | azi2 | ||
) | const throw () |
Return the latitude, lat2, longitude, lon2, and forward azimuth, azi2 (in degrees) of the point 2 which is a distance, s12 (meters), from point 1. s12 can be signed.
Definition at line 607 of file Geodesic.cpp.
References GeographicLib::Constants::degree().
Referenced by main(), and GeographicLib::Geodesic::Direct().
bool GeographicLib::GeodesicLine::Init | ( | ) | const throw () [inline] |
Has this object been initialize so that Position can be called?
Definition at line 215 of file Geodesic.hpp.
double GeographicLib::GeodesicLine::Latitude | ( | ) | const throw () [inline] |
Return the latitude of point 1 (in degrees).
Definition at line 220 of file Geodesic.hpp.
double GeographicLib::GeodesicLine::Longitude | ( | ) | const throw () [inline] |
Return the longitude of point 1 (in degrees).
Definition at line 225 of file Geodesic.hpp.
double GeographicLib::GeodesicLine::Azimuth | ( | ) | const throw () [inline] |
Return the azimuth of the geodesic line as it passes through point 1.
Definition at line 230 of file Geodesic.hpp.
friend class Geodesic [friend] |
Definition at line 182 of file Geodesic.hpp.