GeographicLib
1.38
|
Solve of the direct and inverse rhumb problems. More...
#include <GeographicLib/Rhumb.hpp>
Public Member Functions | |
Rhumb (real a, real f, bool exact=true) | |
void | Direct (real lat1, real lon1, real azi12, real s12, real &lat2, real &lon2) const |
void | Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi12) const |
RhumbLine | Line (real lat1, real lon1, real azi12) const |
Friends | |
class | RhumbLine |
Inspector functions. | |
Math::real | MajorRadius () const |
Math::real | Flattening () const |
static const Rhumb & | WGS84 () |
Solve of the direct and inverse rhumb problems.
The path of constant azimuth between two points on a ellipsoid at (lat1, lon1) and (lat2, lon2) is called the rhumb line (also called the loxodrome). Its length is s12 and its azimuth is azi12 and azi2. (The azimuth is the heading measured clockwise from north.)
Given lat1, lon1, azi12, and s12, we can determine lat2, and lon2. This is the direct rhumb problem and its solution is given by the function Rhumb::Direct.
Given lat1, lon1, lat2, and lon2, we can determine azi12 and s12. This is the inverse rhumb problem, whose solution is given by Rhumb::Inverse. This finds the shortest such rhumb line, i.e., the one that wraps no more than half way around the earth .
Note that rhumb lines may be appreciably longer (up to 50%) than the corresponding Geodesic. For example the distance between London Heathrow and Tokyo Narita via the rhumb line is 11400 km which is 18% longer than the geodesic distance 9600 km.
For more information on rhumb lines see Rhumb lines.
Example of use:
|
inline |
Constructor for a ellipsoid with
[in] | a | equatorial radius (meters). |
[in] | f | flattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. If f > 1, set flattening to 1/f. |
[in] | exact | if true (the default) use an addition theorem for elliptic integrals to compute divided differences; otherwise use series expansion (accurate for |f| < 0.01). |
GeographicErr | if a or (1 − f) a is not positive. |
See Rhumb lines, for a detailed description of the exact parameter.
void GeographicLib::Rhumb::Direct | ( | real | lat1, |
real | lon1, | ||
real | azi12, | ||
real | s12, | ||
real & | lat2, | ||
real & | lon2 | ||
) | const |
Solve the direct rhumb problem.
[in] | lat1 | latitude of point 1 (degrees). |
[in] | lon1 | longitude of point 1 (degrees). |
[in] | azi12 | azimuth of the rhumb line (degrees). |
[in] | s12 | distance between point 1 and point 2 (meters); it can be negative. |
[out] | lat2 | latitude of point 2 (degrees). |
[out] | lon2 | longitude of point 2 (degrees). |
lat1 should be in the range [−90°, 90°]; lon1 and azi1 should be in the range [−540°, 540°). The values of lon2 and azi2 returned are in the range [−180°, 180°).
If point 1 is a pole, the cosine of its latitude is taken to be 1/ε2 (where ε is 2-52). This position, which is extremely close to the actual pole, allows the calculation to be carried out in finite terms. If s12 is large enough that the rhumb line crosses a pole, the longitude of point 2 is indeterminate (a NaN is returned for lon2).
Definition at line 40 of file Rhumb.cpp.
Referenced by main().
void GeographicLib::Rhumb::Inverse | ( | real | lat1, |
real | lon1, | ||
real | lat2, | ||
real | lon2, | ||
real & | s12, | ||
real & | azi12 | ||
) | const |
Solve the inverse rhumb problem.
[in] | lat1 | latitude of point 1 (degrees). |
[in] | lon1 | longitude of point 1 (degrees). |
[in] | lat2 | latitude of point 2 (degrees). |
[in] | lon2 | longitude of point 2 (degrees). |
[out] | s12 | rhumb distance between point 1 and point 2 (meters). |
[out] | azi12 | azimuth of the rhumb line (degrees). |
The shortest rhumb line is found. lat1 and lat2 should be in the range [−90°, 90°]; lon1 and lon2 should be in the range [−540°, 540°). The value of azi12 returned is in the range [−180°, 180°).
If either point is a pole, the cosine of its latitude is taken to be 1/ε2 (where ε is 2-52). This position, which is extremely close to the actual pole, allows the calculation to be carried out in finite terms.
Definition at line 23 of file Rhumb.cpp.
References GeographicLib::Math::AngDiff(), GeographicLib::Math::AngNormalize(), GeographicLib::Math::degree(), and GeographicLib::Math::hypot().
Referenced by main().
RhumbLine GeographicLib::Rhumb::Line | ( | real | lat1, |
real | lon1, | ||
real | azi12 | ||
) | const |
Set up to compute several points on a single rhumb line.
[in] | lat1 | latitude of point 1 (degrees). |
[in] | lon1 | longitude of point 1 (degrees). |
[in] | azi12 | azimuth of the rhumb line (degrees). |
lat1 should be in the range [−90°, 90°]; lon1 and azi12 should be in the range [−540°, 540°).
If point 1 is a pole, the cosine of its latitude is taken to be 1/ε2 (where ε is 2-52). This position, which is extremely close to the actual pole, allows the calculation to be carried out in finite terms.
Definition at line 37 of file Rhumb.cpp.
Referenced by main().
|
inline |
|
inline |
|
static |
A global instantiation of Rhumb with the parameters for the WGS84 ellipsoid.
Definition at line 18 of file Rhumb.cpp.
References GeographicLib::Constants::WGS84_a(), and GeographicLib::Constants::WGS84_f().