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 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 <exception>
#include <cmath>
#include <iomanip>
using namespace std;
using namespace GeographicLib;
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 ds = 500e3;
int num = int(ceil(s12 / ds));
cout << fixed << setprecision(3);
{
double ds = s12 / num;
for (int i = 0; i <= num; ++i) {
double lat, lon;
cout << i << " " << lat << " " << lon << "\n";
}
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
return 0;
}
Definition at line 275 of file Rhumb.hpp.
void GeographicLib::RhumbLine::Position |
( |
real |
s12, |
|
|
real & |
lat2, |
|
|
real & |
lon2 |
|
) |
| const |