10 #if !defined(GEOGRAPHICLIB_TRIGFUN_HPP) 11 #define GEOGRAPHICLIB_TRIGFUN_HPP 1 20 # pragma warning (push) 21 # pragma warning (disable: 4251) 73 static constexpr
bool debug_ =
false;
74 static constexpr
bool throw_ =
true;
75 static constexpr
int maxit_ = 300;
79 std::vector<real> _coeff;
82 static int chop(
const std::vector<real>& c, real tol, real scale = -1);
83 static real tolerance(real tol) {
84 static const real eps = std::numeric_limits<real>::epsilon();
85 return tol <= 0 ? eps : tol;
125 Trigfun(
const std::vector<real>& c,
bool odd,
bool sym, real h)
127 , _n(sym ? _m : _m - 1)
135 void refine(
const Trigfun& tb);
136 real check(
const std::vector<real>& F,
bool centerp, real tol)
const;
140 real inversep(real z,
const std::function<
real(real)>& fp,
141 real dx0,
int* countn,
int* countb, real tol)
const;
142 static Trigfun initbysamples(
const std::vector<real>& F,
143 bool odd,
bool sym, real halfp,
bool centerp);
189 real root(ind indicator, real z,
const std::function<
real(real)>& fp,
190 real x0,
int* countn,
int* countb, real tol)
const;
229 static real root(ind indicator,
230 const std::function<std::pair<real, real>(real)>& ffp,
232 real x0, real xa, real xb,
233 real xscale = 1, real zscale = 1,
int s = 1,
234 int* countn =
nullptr,
int* countb =
nullptr,
264 Trigfun inverse(
const std::function<
real(real)>& fp,
265 int* countn,
int* countb,
266 int nmax, real tol, real scale)
const;
309 bool odd,
bool sym,
real halfp,
bool centerp =
false);
342 real halfp,
int nmax = 1 << 16,
376 real halfp,
int nmax = 1 << 16,
386 void setsecular(
real f0);
434 int nmax = 1 << 16, real tol = 0, real scale = -1)
const {
435 return inverse(fp,
nullptr,
nullptr, nmax, tol, scale);
442 bool Odd()
const {
return _odd; }
472 return _odd && !_sym ? _coeff[0] *
Math::pi() : Max();
481 return _odd && !_sym ? HalfRange() / HalfPeriod() : 0;
504 std::function<real(real)> _fp;
510 int _countn, _countb;
513 real inv0(real z)
const {
518 real inv1(real z,
int* countn,
int* countb)
const {
523 real inv2(real z,
int* countn,
int* countb)
const {
526 _f.root(Trigfun::INV2, z, _fp, _finv(z), countn, countb, 0);
528 real inv(real z,
int* countn,
int* countb)
const {
529 return _invp ? inv2(z, countn, countb) : inv1(z, countn, countb);
549 bool sym =
false,
real scale = -1);
564 real
deriv(real x)
const {
return _fp(x); }
578 return _invp ? inv2(z,
nullptr,
nullptr) : inv1(z,
nullptr,
nullptr);
592 if (!_invp && !_sym) {
593 _countn = _countb = 0;
594 _finv = _f.inverse(_fp, &_countn, &_countb, _nmax, _tol, -1);
612 if (!_invp)
return -1;
634 #if defined(_MSC_VER) 635 # pragma warning (pop) 638 #endif // GEOGRAPHICLIB_TRIGFUN_HPP A function defined by its derivative and its inverse.
Representing a function by a Fourier series.
#define GEOGRAPHICLIB_EXPORT
Trigfun inverse(const std::function< real(real)> &fp, int nmax=1<< 16, real tol=0, real scale=-1) const
Mathematical functions needed by GeographicLib.
The direct geodesic problem for a triaxial ellipsoid.
real operator()(real x) const
Namespace for GeographicLib.
GeographicLib::Math::real real
Header for GeographicLib::Constants class.