Find a sequence of points on a single rhumb line.
RhumbLine facilitates the determination of a series of points on a single rhumb line. The starting point (lat1, lon1) and the azimuth azi12 are specified in the call to Rhumb::Line which returns a RhumbLine object. RhumbLine.Position returns the location of point 2 (and, optionally, the corresponding area, S12) a distance s12 along the rhumb line.
There is no public constructor for this class. (Use Rhumb::Line to create an instance.) The Rhumb object used to create a RhumbLine must stay in scope as long as the RhumbLine.
Example of use:
#include <iostream>
#include <iomanip>
#include <exception>
#include <cmath>
try {
double
lat1 = 40.640, lon1 = -73.779,
lat2 = 1.359, lon2 = 103.989;
double s12, azi12;
rhumb.Inverse(lat1, lon1, lat2, lon2, s12, azi12);
double ds0 = 500e3;
cout << fixed << setprecision(3);
{
double ds = s12 / num;
for (
int i = 0;
i <= num; ++
i) {
cout <<
i <<
" " <<
lat <<
" " <<
lon <<
"\n";
}
}
}
catch (
const exception&
e) {
cerr <<
"Caught exception: " <<
e.what() <<
"\n";
return 1;
}
}
Definition at line 437 of file Rhumb.hpp.
void GeographicLib::RhumbLine::GenPosition |
( |
real |
s12, |
|
|
unsigned |
outmask, |
|
|
real & |
lat2, |
|
|
real & |
lon2, |
|
|
real & |
S12 |
|
) |
| const |
The general position routine. RhumbLine::Position is defined in term so this function.
- Parameters
-
[in] | s12 | distance between point 1 and point 2 (meters); it can be negative. |
[in] | outmask | a bitor'ed combination of RhumbLine::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 RhumbLine::mask values possible for outmask are
With the RhumbLine::LONG_UNROLL bit set, the quantity lon2 − lon1 indicates how many times and in what sense the rhumb line encircles the ellipsoid.
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).
Definition at line 347 of file src/Rhumb.cpp.
void GeographicLib::RhumbLine::Position |
( |
real |
s12, |
|
|
real & |
lat2, |
|
|
real & |
lon2, |
|
|
real & |
S12 |
|
) |
| const |
|
inline |
Compute the position of point 2 which is a distance s12 (meters) from point 1. The area is also computed.
- Parameters
-
[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). |
The value of lon2 returned is in the range [−180°, 180°].
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).
Definition at line 512 of file Rhumb.hpp.