10 #if !defined(GEOGRAPHICLIB_RHUMB_HPP)
11 #define GEOGRAPHICLIB_RHUMB_HPP 1
16 #if !defined(GEOGRAPHICLIB_RHUMBAREA_ORDER)
21 # define GEOGRAPHICLIB_RHUMBAREA_ORDER \
22 (GEOGRAPHICLIB_PRECISION == 2 ? 6 : \
23 (GEOGRAPHICLIB_PRECISION == 1 ? 4 : 8))
29 template <
class T>
class PolygonAreaT;
78 static inline real overflow() {
81 overflow = 1 /
Math::sq(std::numeric_limits<real>::epsilon());
84 static inline real tano(real x) {
85 using std::abs;
using std::tan;
90 y ==
Math::pi() ? (x < 0 ? - overflow() : overflow()) : tan(x);
92 static inline real gd(real x)
93 {
using std::atan;
using std::sinh;
return atan(sinh(x)); }
106 static inline real Dlog(real x, real y) {
108 return t ? 2 *
Math::atanh(t / (x + y)) / t : 1 / x;
110 static inline real Dtan(real x, real y) {
111 real d = x - y, tx = tano(x), ty = tano(y), txy = tx * ty;
112 return d ? (2 * txy > -1 ? (1 + txy) * tano(d) : tx - ty) / d :
115 static inline real Datan(real x, real y) {
117 real d = x - y, xy = x * y;
118 return d ? (2 * xy > -1 ? atan( d / (1 + xy) ) : atan(x) - atan(y)) / d :
121 static inline real Dsin(real x, real y) {
122 using std::sin;
using std::cos;
123 real d = (x - y) / 2;
124 return cos((x + y)/2) * (d ? sin(d) / d : 1);
126 static inline real Dsinh(real x, real y) {
127 using std::sinh;
using std::cosh;
128 real d = (x - y) / 2;
129 return cosh((x + y) / 2) * (d ? sinh(d) / d : 1);
131 static inline real Dcosh(real x, real y) {
133 real d = (x - y) / 2;
134 return sinh((x + y) / 2) * (d ? sinh(d) / d : 1);
136 static inline real Dasinh(real x, real y) {
139 return d ?
Math::asinh(x*y > 0 ? d * (x + y) / (x*hy + y*hx) :
143 static inline real Dgd(real x, real y) {
145 return Datan(sinh(x), sinh(y)) * Dsinh(x, y);
147 static inline real Dgdinv(real x, real y) {
148 return Dasinh(tano(x), tano(y)) * Dtan(x, y);
153 inline real eatanhe(real x)
const {
155 return _ell._f >= 0 ? _ell._e *
Math::atanh(_ell._e * x) :
156 - _ell._e * atan(_ell._e * x);
160 inline real Deatanhe(real x, real y)
const {
161 real t = x - y, d = 1 - _ell._e2 * x * y;
162 return t ? eatanhe(t / d) / t : _ell._e2 / d;
165 real DE(real x, real y)
const;
167 real DRectifying(real latx, real laty)
const;
169 real DIsometric(real latx, real laty)
const;
172 static real SinCosSeries(
bool sinp,
173 real x, real y,
const real c[],
int n);
175 real DConformalToRectifying(real chix, real chiy)
const;
177 real DRectifyingToConformal(real mux, real muy)
const;
180 real DIsometricToRectifying(real psix, real psiy)
const;
182 real DRectifyingToIsometric(real mux, real muy)
const;
184 real MeanSinXi(real psi1, real psi2)
const;
189 void GenDirect(real lat1, real lon1, real azi12,
190 bool, real s12,
unsigned outmask,
191 real& lat2, real& lon2, real&, real&, real&, real&, real&,
193 GenDirect(lat1, lon1, azi12, s12, outmask, lat2, lon2, S12);
195 void GenInverse(real lat1, real lon1, real lat2, real lon2,
196 unsigned outmask, real& s12, real& azi12,
197 real&, real& , real& , real& , real& S12)
const {
198 GenInverse(lat1, lon1, lat2, lon2, outmask, s12, azi12, S12);
242 LONG_NOWRAP = 1U<<15,
265 Rhumb(real a, real f,
bool exact =
true);
290 void Direct(real lat1, real lon1, real azi12, real s12,
291 real& lat2, real& lon2, real& S12)
const {
292 GenDirect(lat1, lon1, azi12, s12,
293 LATITUDE | LONGITUDE | AREA, lat2, lon2, S12);
299 void Direct(real lat1, real lon1, real azi12, real s12,
300 real& lat2, real& lon2)
const {
302 GenDirect(lat1, lon1, azi12, s12, LATITUDE | LONGITUDE, lat2, lon2, t);
334 void GenDirect(real lat1, real lon1, real azi12, real s12,
unsigned outmask,
335 real& lat2, real& lon2, real& S12)
const;
360 void Inverse(real lat1, real lon1, real lat2, real lon2,
361 real& s12, real& azi12, real& S12)
const {
362 GenInverse(lat1, lon1, lat2, lon2,
363 DISTANCE | AZIMUTH | AREA, s12, azi12, S12);
369 void Inverse(real lat1, real lon1, real lat2, real lon2,
370 real& s12, real& azi12)
const {
372 GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH, s12, azi12, t);
395 void GenInverse(real lat1, real lon1, real lat2, real lon2,
397 real& s12, real& azi12, real& S12)
const;
415 RhumbLine Line(real lat1, real lon1, real azi12)
const;
439 static const Rhumb& WGS84();
466 real _lat1, _lon1, _azi12, _salp, _calp, _mu1, _psi1, _r1;
532 void Position(real s12, real& lat2, real& lon2, real& S12)
const {
533 GenPosition(s12, LATITUDE | LONGITUDE | AREA, lat2, lon2, S12);
540 void Position(real s12, real& lat2, real& lon2)
const {
542 GenPosition(s12, LATITUDE | LONGITUDE, lat2, lon2, t);
575 void GenPosition(real s12,
unsigned outmask,
576 real& lat2, real& lon2, real& S12)
const;
612 #endif // GEOGRAPHICLIB_RHUMB_HPP
void Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi12, real &S12) const
#define GEOGRAPHICLIB_EXPORT
GeographicLib::Math::real real
void Position(real s12, real &lat2, real &lon2) const
#define GEOGRAPHICLIB_RHUMBAREA_ORDER
Math::real Latitude() const
#define GEOGRAPHICLIB_VOLATILE
Math::real MajorRadius() const
Math::real EllipsoidArea() const
Math::real MajorRadius() const
Math::real Azimuth() const
Math::real Longitude() const
Namespace for GeographicLib.
#define GEOGRAPHICLIB_TRANSVERSEMERCATOR_ORDER
Header for GeographicLib::Ellipsoid class.
Math::real Flattening() const
Properties of an ellipsoid.
Math::real MajorRadius() const
Header for GeographicLib::Constants class.
Solve of the direct and inverse rhumb problems.
void Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi12) const
Find a sequence of points on a single rhumb line.
Math::real Flattening() const
void Direct(real lat1, real lon1, real azi12, real s12, real &lat2, real &lon2) const
Math::real Flattening() const
void Direct(real lat1, real lon1, real azi12, real s12, real &lat2, real &lon2, real &S12) const
void Position(real s12, real &lat2, real &lon2, real &S12) const