10 #if !defined(GEOGRAPHICLIB_RHUMB_HPP)
11 #define GEOGRAPHICLIB_RHUMB_HPP 1
16 namespace GeographicLib {
55 static inline real overflow() {
58 overflow = 1 /
Math::sq(std::numeric_limits<real>::epsilon());
62 using std::abs;
using std::tan;
64 2 * abs(x) ==
Math::pi() ? (x < 0 ? - overflow() : overflow()) :
68 {
using std::atan;
using std::sinh;
return atan(sinh(x)); }
82 real d = x - y, tx = tano(x), ty = tano(y), txy = tx * ty;
83 return d ? (2 * txy > -1 ? (1 + txy) * tano(d) : tx - ty) / d :
88 real d = x - y, xy = x * y;
89 return d ? (2 * xy > -1 ? atan( d / (1 + xy) ) : atan(x) - atan(y)) / d :
93 using std::sin;
using std::cos;
95 return cos((x + y)/2) * (d ? sin(d) / d : 1);
98 using std::sinh;
using std::cosh;
100 return cosh((x + y)/2) * (d ? sinh(d) / d : 1);
105 return d ?
Math::asinh(x*y > 0 ? d * (x + y) / (x*hy + y*hx) :
111 return Datan(sinh(x), sinh(y)) * Dsinh(x, y);
114 return Dasinh(tano(x), tano(y)) * Dtan(x, y);
121 return _ell._f >= 0 ? _ell._e *
Math::atanh(_ell._e * x) :
122 - _ell._e * atan(_ell._e * x);
127 real t = x - y, d = 1 - _ell._e2 * x * y;
128 return t ? eatanhe(t / d) / t : _ell._e2 / d;
140 real DConformalToRectifying(
real chix,
real chiy)
const;
145 real DIsometricToRectifying(
real psix,
real psiy)
const;
166 Rhumb(real a, real f,
bool exact =
true) : _ell(a, f), _exact(exact) {}
255 static const Rhumb& WGS84();
281 real _lat1, _lon1, _azi12, _salp, _calp, _mu1, _psi1, _r1;
301 void Position(real s12, real& lat2, real& lon2)
const;
337 #endif // GEOGRAPHICLIB_RHUMB_HPP