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;
87 2 * abs(x) ==
Math::pi() ? (x < 0 ? - overflow() : overflow()) :
90 static inline real gd(real x)
91 {
using std::atan;
using std::sinh;
return atan(sinh(x)); }
104 static inline real Dlog(real x, real y) {
106 return t ? 2 *
Math::atanh(t / (x + y)) / t : 1 / x;
108 static inline real Dtan(real x, real y) {
109 real d = x - y, tx = tano(x), ty = tano(y), txy = tx * ty;
110 return d ? (2 * txy > -1 ? (1 + txy) * tano(d) : tx - ty) / d :
113 static inline real Datan(real x, real y) {
115 real d = x - y, xy = x * y;
116 return d ? (2 * xy > -1 ? atan( d / (1 + xy) ) : atan(x) - atan(y)) / d :
119 static inline real Dsin(real x, real y) {
120 using std::sin;
using std::cos;
121 real d = (x - y) / 2;
122 return cos((x + y)/2) * (d ? sin(d) / d : 1);
124 static inline real Dsinh(real x, real y) {
125 using std::sinh;
using std::cosh;
126 real d = (x - y) / 2;
127 return cosh((x + y) / 2) * (d ? sinh(d) / d : 1);
129 static inline real Dcosh(real x, real y) {
131 real d = (x - y) / 2;
132 return sinh((x + y) / 2) * (d ? sinh(d) / d : 1);
134 static inline real Dasinh(real x, real y) {
137 return d ?
Math::asinh(x*y > 0 ? d * (x + y) / (x*hy + y*hx) :
141 static inline real Dgd(real x, real y) {
143 return Datan(sinh(x), sinh(y)) * Dsinh(x, y);
145 static inline real Dgdinv(real x, real y) {
146 return Dasinh(tano(x), tano(y)) * Dtan(x, y);
151 inline real eatanhe(real x)
const {
153 return _ell._f >= 0 ? _ell._e *
Math::atanh(_ell._e * x) :
154 - _ell._e * atan(_ell._e * x);
158 inline real Deatanhe(real x, real y)
const {
159 real t = x - y, d = 1 - _ell._e2 * x * y;
160 return t ? eatanhe(t / d) / t : _ell._e2 / d;
163 real DE(real x, real y)
const;
165 real DRectifying(real latx, real laty)
const;
167 real DIsometric(real latx, real laty)
const;
170 static real SinCosSeries(
bool sinp,
171 real x, real y,
const real c[],
int n);
173 real DConformalToRectifying(real chix, real chiy)
const;
175 real DRectifyingToConformal(real mux, real muy)
const;
178 real DIsometricToRectifying(real psix, real psiy)
const;
180 real DRectifyingToIsometric(real mux, real muy)
const;
182 real MeanSinXi(real psi1, real psi2)
const;
187 void GenDirect(real lat1, real lon1, real azi12,
188 bool, real s12,
unsigned outmask,
189 real& lat2, real& lon2, real&, real&, real&, real&, real&,
191 GenDirect(lat1, lon1, azi12, s12, outmask, lat2, lon2, S12);
193 void GenInverse(real lat1, real lon1, real lat2, real lon2,
194 unsigned outmask, real& s12, real& azi12,
195 real&, real& , real& , real& , real& S12)
const {
196 GenInverse(lat1, lon1, lat2, lon2, outmask, s12, azi12, S12);
240 LONG_NOWRAP = 1U<<15,
263 Rhumb(real a, real f,
bool exact =
true);
288 void Direct(real lat1, real lon1, real azi12, real s12,
289 real& lat2, real& lon2, real& S12)
const {
290 GenDirect(lat1, lon1, azi12, s12,
291 LATITUDE | LONGITUDE | AREA, lat2, lon2, S12);
297 void Direct(real lat1, real lon1, real azi12, real s12,
298 real& lat2, real& lon2)
const {
300 GenDirect(lat1, lon1, azi12, s12, LATITUDE | LONGITUDE, lat2, lon2, t);
332 void GenDirect(real lat1, real lon1, real azi12, real s12,
unsigned outmask,
333 real& lat2, real& lon2, real& S12)
const;
358 void Inverse(real lat1, real lon1, real lat2, real lon2,
359 real& s12, real& azi12, real& S12)
const {
360 GenInverse(lat1, lon1, lat2, lon2,
361 DISTANCE | AZIMUTH | AREA, s12, azi12, S12);
367 void Inverse(real lat1, real lon1, real lat2, real lon2,
368 real& s12, real& azi12)
const {
370 GenInverse(lat1, lon1, lat2, lon2, DISTANCE | AZIMUTH, s12, azi12, t);
393 void GenInverse(real lat1, real lon1, real lat2, real lon2,
395 real& s12, real& azi12, real& S12)
const;
413 RhumbLine Line(real lat1, real lon1, real azi12)
const;
437 static const Rhumb& WGS84();
464 real _lat1, _lon1, _azi12, _salp, _calp, _mu1, _psi1, _r1;
530 void Position(real s12, real& lat2, real& lon2, real& S12)
const {
531 GenPosition(s12, LATITUDE | LONGITUDE | AREA, lat2, lon2, S12);
538 void Position(real s12, real& lat2, real& lon2)
const {
540 GenPosition(s12, LATITUDE | LONGITUDE, lat2, lon2, t);
573 void GenPosition(real s12,
unsigned outmask,
574 real& lat2, real& lon2, real& S12)
const;
610 #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
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