Solve of the direct and inverse rhumb problems. More...
#include <Rhumb.hpp>
Public Types | |
enum | mask { NONE, LATITUDE, LONGITUDE, AZIMUTH, DISTANCE, AREA, LONG_UNROLL, ALL } |
Public Member Functions | |
void | Direct (real lat1, real lon1, real azi12, real s12, real &lat2, real &lon2) const |
void | Direct (real lat1, real lon1, real azi12, real s12, real &lat2, real &lon2, real &S12) const |
void | GenDirect (real lat1, real lon1, real azi12, real s12, unsigned outmask, real &lat2, real &lon2, real &S12) const |
void | GenInverse (real lat1, real lon1, real lat2, real lon2, unsigned outmask, real &s12, real &azi12, real &S12) const |
void | Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi12) const |
void | Inverse (real lat1, real lon1, real lat2, real lon2, real &s12, real &azi12, real &S12) const |
RhumbLine | Line (real lat1, real lon1, real azi12) const |
Rhumb (real a, real f, bool exact=true) | |
Private Types | |
typedef Math::real | real |
Private Member Functions | |
real | DConformalToRectifying (real chix, real chiy) const |
real | DE (real x, real y) const |
real | Deatanhe (real x, real y) const |
real | DIsometric (real latx, real laty) const |
real | DIsometricToRectifying (real psix, real psiy) const |
real | DRectifying (real latx, real laty) const |
real | DRectifyingToConformal (real mux, real muy) const |
real | DRectifyingToIsometric (real mux, real muy) const |
void | GenDirect (real lat1, real lon1, real azi12, bool, real s12, unsigned outmask, real &lat2, real &lon2, real &, real &, real &, real &, real &, real &S12) const |
void | GenInverse (real lat1, real lon1, real lat2, real lon2, unsigned outmask, real &s12, real &azi12, real &, real &, real &, real &, real &S12) const |
real | MeanSinXi (real psi1, real psi2) const |
Static Private Member Functions | |
static real | Dasinh (real x, real y) |
static real | Datan (real x, real y) |
static real | Dcosh (real x, real y) |
static real | Dgd (real x, real y) |
static real | Dgdinv (real x, real y) |
static real | Dlog (real x, real y) |
static real | Dsin (real x, real y) |
static real | Dsinh (real x, real y) |
static real | Dtan (real x, real y) |
static real | gd (real x) |
static real | SinCosSeries (bool sinp, real x, real y, const real c[], int n) |
Private Attributes | |
real | _c2 |
Ellipsoid | _ell |
bool | _exact |
real | _R [maxpow_+1] |
Static Private Attributes | |
static const int | maxpow_ = GEOGRAPHICLIB_RHUMBAREA_ORDER |
static const int | tm_maxord = GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER |
Friends | |
template<class T > | |
class | PolygonAreaT |
class | RhumbLine |
Inspector functions. | |
Math::real | MajorRadius () const |
Math::real | Flattening () const |
Math::real | EllipsoidArea () 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. (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. If the end points are on opposite meridians, there are two shortest rhumb lines and the east-going one is chosen.
These routines also optionally calculate the area under the rhumb line, S12. This is the area, measured counter-clockwise, of the rhumb line quadrilateral with corners (lat1,lon1), (0,lon1), (0,lon2), and (lat2,lon2).
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.
Example of use:
|
private |
Bit masks for what calculations to do. They specify which results to return in the general routines Rhumb::GenDirect and Rhumb::GenInverse routines. RhumbLine::mask is a duplication of this enum.
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. |
[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, for a detailed description of the exact parameter.
Definition at line 18 of file src/Rhumb.cpp.
|
private |
Definition at line 292 of file src/Rhumb.cpp.
|
private |
Definition at line 176 of file src/Rhumb.cpp.
|
inline |
Solve the direct rhumb problem returning also the area.
[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). |
[out] | S12 | area under the rhumb line (meters2). |
lat1 should be in the range [−90°, 90°]. The value of lon2 returned is 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 and S12).
|
private |
Definition at line 213 of file src/Rhumb.cpp.
|
private |
Definition at line 302 of file src/Rhumb.cpp.
|
private |
Definition at line 205 of file src/Rhumb.cpp.
|
private |
Definition at line 297 of file src/Rhumb.cpp.
|
private |
Definition at line 315 of file src/Rhumb.cpp.
|
inline |
|
inline |
void GeographicLib::Rhumb::GenDirect | ( | real | lat1, |
real | lon1, | ||
real | azi12, | ||
real | s12, | ||
unsigned | outmask, | ||
real & | lat2, | ||
real & | lon2, | ||
real & | S12 | ||
) | const |
The general direct rhumb problem. Rhumb::Direct is defined in terms of this function.
[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. |
[in] | outmask | a bitor'ed combination of Rhumb::mask values specifying which of the following parameters should be set. |
[out] | lat2 | latitude of point 2 (degrees). |
[out] | lon2 | longitude of point 2 (degrees). |
[out] | S12 | area under the rhumb line (meters2). |
The Rhumb::mask values possible for outmask are
With the Rhumb::LONG_UNROLL bit set, the quantity lon2 − lon1 indicates how many times and in what sense the rhumb line encircles the ellipsoid.
Definition at line 171 of file src/Rhumb.cpp.
void GeographicLib::Rhumb::GenInverse | ( | real | lat1, |
real | lon1, | ||
real | lat2, | ||
real | lon2, | ||
unsigned | outmask, | ||
real & | s12, | ||
real & | azi12, | ||
real & | S12 | ||
) | const |
The general inverse rhumb problem. Rhumb::Inverse is defined in terms of this function.
[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). |
[in] | outmask | a bitor'ed combination of Rhumb::mask values specifying which of the following parameters should be set. |
[out] | s12 | rhumb distance between point 1 and point 2 (meters). |
[out] | azi12 | azimuth of the rhumb line (degrees). |
[out] | S12 | area under the rhumb line (meters2). |
The Rhumb::mask values possible for outmask are
Definition at line 148 of file src/Rhumb.cpp.
|
inline |
Solve the inverse rhumb problem returning also the area.
[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). |
[out] | S12 | area under the rhumb line (meters2). |
The shortest rhumb line is found. If the end points are on opposite meridians, there are two shortest rhumb lines and the east-going one is chosen. lat1 and lat2 should be in the range [−90°, 90°]. 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.
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°].
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 168 of file src/Rhumb.cpp.
|
inline |
|
private |
Definition at line 326 of file src/Rhumb.cpp.
|
staticprivate |
Definition at line 221 of file src/Rhumb.cpp.
|
static |
A global instantiation of Rhumb with the parameters for the WGS84 ellipsoid.
Definition at line 142 of file src/Rhumb.cpp.
|
friend |
|
staticprivate |
|
staticprivate |