LambertConformalConic.hpp
Go to the documentation of this file.
1 
10 #if !defined(GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP)
11 #define GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP 1
12 
14 
15 namespace GeographicLib {
16 
64  private:
65  typedef Math::real real;
66  real eps_, epsx_, ahypover_;
67  real _a, _f, _fm, _e2, _es;
68  real _sign, _n, _nc, _t0nm1, _scale, _lat0, _k0;
69  real _scbet0, _tchi0, _scchi0, _psi0, _nrho0, _drhomax;
70  static const int numit_ = 5;
71  static real hyp(real x) { return Math::hypot(real(1), x); }
72  // Divided differences
73  // Definition: Df(x,y) = (f(x)-f(y))/(x-y)
74  // See:
75  // W. M. Kahan and R. J. Fateman,
76  // Symbolic computation of divided differences,
77  // SIGSAM Bull. 33(3), 7-28 (1999)
78  // https://doi.org/10.1145/334714.334716
79  // http://www.cs.berkeley.edu/~fateman/papers/divdiff.pdf
80  //
81  // General rules
82  // h(x) = f(g(x)): Dh(x,y) = Df(g(x),g(y))*Dg(x,y)
83  // h(x) = f(x)*g(x):
84  // Dh(x,y) = Df(x,y)*g(x) + Dg(x,y)*f(y)
85  // = Df(x,y)*g(y) + Dg(x,y)*f(x)
86  // = Df(x,y)*(g(x)+g(y))/2 + Dg(x,y)*(f(x)+f(y))/2
87  //
88  // hyp(x) = sqrt(1+x^2): Dhyp(x,y) = (x+y)/(hyp(x)+hyp(y))
89  static real Dhyp(real x, real y, real hx, real hy)
90  // hx = hyp(x)
91  { return (x + y) / (hx + hy); }
92  // sn(x) = x/sqrt(1+x^2): Dsn(x,y) = (x+y)/((sn(x)+sn(y))*(1+x^2)*(1+y^2))
93  static real Dsn(real x, real y, real sx, real sy) {
94  // sx = x/hyp(x)
95  real t = x * y;
96  return t > 0 ? (x + y) * Math::sq( (sx * sy)/t ) / (sx + sy) :
97  (x - y != 0 ? (sx - sy) / (x - y) : 1);
98  }
99  // Dlog1p(x,y) = log1p((x-y)/(1+y))/(x-y)
100  static real Dlog1p(real x, real y) {
101  real t = x - y; if (t < 0) { t = -t; y = x; }
102  return t != 0 ? Math::log1p(t / (1 + y)) / t : 1 / (1 + x);
103  }
104  // Dexp(x,y) = exp((x+y)/2) * 2*sinh((x-y)/2)/(x-y)
105  static real Dexp(real x, real y) {
106  using std::sinh; using std::exp;
107  real t = (x - y)/2;
108  return (t != 0 ? sinh(t)/t : 1) * exp((x + y)/2);
109  }
110  // Dsinh(x,y) = 2*sinh((x-y)/2)/(x-y) * cosh((x+y)/2)
111  // cosh((x+y)/2) = (c+sinh(x)*sinh(y)/c)/2
112  // c=sqrt((1+cosh(x))*(1+cosh(y)))
113  // cosh((x+y)/2) = sqrt( (sinh(x)*sinh(y) + cosh(x)*cosh(y) + 1)/2 )
114  static real Dsinh(real x, real y, real sx, real sy, real cx, real cy)
115  // sx = sinh(x), cx = cosh(x)
116  {
117  // real t = (x - y)/2, c = sqrt((1 + cx) * (1 + cy));
118  // return (t ? sinh(t)/t : real(1)) * (c + sx * sy / c) /2;
119  using std::sinh; using std::sqrt;
120  real t = (x - y)/2;
121  return (t != 0 ? sinh(t)/t : 1) * sqrt((sx * sy + cx * cy + 1) /2);
122  }
123  // Dasinh(x,y) = asinh((x-y)*(x+y)/(x*sqrt(1+y^2)+y*sqrt(1+x^2)))/(x-y)
124  // = asinh((x*sqrt(1+y^2)-y*sqrt(1+x^2)))/(x-y)
125  static real Dasinh(real x, real y, real hx, real hy) {
126  // hx = hyp(x)
127  real t = x - y;
128  return t != 0 ?
129  Math::asinh(x*y > 0 ? t * (x+y) / (x*hy + y*hx) : x*hy - y*hx) / t :
130  1/hx;
131  }
132  // Deatanhe(x,y) = eatanhe((x-y)/(1-e^2*x*y))/(x-y)
133  real Deatanhe(real x, real y) const {
134  real t = x - y, d = 1 - _e2 * x * y;
135  return t != 0 ? Math::eatanhe(t / d, _es) / t : _e2 / d;
136  }
137  void Init(real sphi1, real cphi1, real sphi2, real cphi2, real k1);
138  public:
139 
154 
170  LambertConformalConic(real a, real f, real stdlat1, real stdlat2, real k1);
171 
201  real sinlat1, real coslat1,
202  real sinlat2, real coslat2,
203  real k1);
204 
214  void SetScale(real lat, real k = real(1));
215 
235  void Forward(real lon0, real lat, real lon,
236  real& x, real& y, real& gamma, real& k) const;
237 
255  void Reverse(real lon0, real x, real y,
256  real& lat, real& lon, real& gamma, real& k) const;
257 
263  real& x, real& y) const {
264  real gamma, k;
265  Forward(lon0, lat, lon, x, y, gamma, k);
266  }
267 
273  real& lat, real& lon) const {
274  real gamma, k;
275  Reverse(lon0, x, y, lat, lon, gamma, k);
276  }
277 
280 
285  Math::real MajorRadius() const { return _a; }
286 
291  Math::real Flattening() const { return _f; }
292 
300  Math::real OriginLatitude() const { return _lat0; }
301 
306  Math::real CentralScale() const { return _k0; }
308 
314  static const LambertConformalConic& Mercator();
315  };
316 
317 } // namespace GeographicLib
318 
319 #endif // GEOGRAPHICLIB_LAMBERTCONFORMALCONIC_HPP
Eigen::Forward
@ Forward
Definition: NumericalDiff.h:19
GeographicLib::LambertConformalConic::hyp
static real hyp(real x)
Definition: LambertConformalConic.hpp:71
cy
const double cy
Definition: testSmartStereoFactor_iSAM2.cpp:50
GeographicLib::LambertConformalConic::CentralScale
Math::real CentralScale() const
Definition: LambertConformalConic.hpp:306
d
static const double d[K][N]
Definition: igam.h:11
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
GeographicLib::LambertConformalConic::Dsinh
static real Dsinh(real x, real y, real sx, real sy, real cx, real cy)
Definition: LambertConformalConic.hpp:114
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
real
float real
Definition: datatypes.h:10
GeographicLib::LambertConformalConic::Dlog1p
static real Dlog1p(real x, real y)
Definition: LambertConformalConic.hpp:100
GEOGRAPHICLIB_EXPORT
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:91
exp
const EIGEN_DEVICE_FUNC ExpReturnType exp() const
Definition: ArrayCwiseUnaryOps.h:97
GeographicLib::LambertConformalConic::_tchi0
real _tchi0
Definition: LambertConformalConic.hpp:69
k0
double k0(double x)
Definition: k0.c:131
GeographicLib::LambertConformalConic::_fm
real _fm
Definition: LambertConformalConic.hpp:67
GeographicLib::LambertConformalConic::epsx_
real epsx_
Definition: LambertConformalConic.hpp:66
GeographicLib::Math::real
double real
Definition: Math.hpp:129
GeographicLib::LambertConformalConic::Dhyp
static real Dhyp(real x, real y, real hx, real hy)
Definition: LambertConformalConic.hpp:89
GeographicLib::Math::log1p
static T log1p(T x)
Definition: Math.hpp:288
example::lon0
const double lon0
Definition: testGPSFactor.cpp:41
GeographicLib::LambertConformalConic::Dexp
static real Dexp(real x, real y)
Definition: LambertConformalConic.hpp:105
k1
double k1(double x)
Definition: k1.c:133
GeographicLib::LambertConformalConic::OriginLatitude
Math::real OriginLatitude() const
Definition: LambertConformalConic.hpp:300
GeographicLib::LambertConformalConic::Dasinh
static real Dasinh(real x, real y, real hx, real hy)
Definition: LambertConformalConic.hpp:125
GeographicLib::Math::asinh
static T asinh(T x)
Definition: Math.hpp:311
GeographicLib::LambertConformalConic::Dsn
static real Dsn(real x, real y, real sx, real sy)
Definition: LambertConformalConic.hpp:93
gamma
#define gamma
Definition: mconf.h:85
Constants.hpp
Header for GeographicLib::Constants class.
GeographicLib::LambertConformalConic::Forward
void Forward(real lon0, real lat, real lon, real &x, real &y) const
Definition: LambertConformalConic.hpp:262
y
Scalar * y
Definition: level1_cplx_impl.h:124
tree::f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Definition: testExpression.cpp:218
GeographicLib::LambertConformalConic::_t0nm1
real _t0nm1
Definition: LambertConformalConic.hpp:68
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
GeographicLib::LambertConformalConic::MajorRadius
Math::real MajorRadius() const
Definition: LambertConformalConic.hpp:285
GeographicLib::LambertConformalConic
Lambert conformal conic projection.
Definition: LambertConformalConic.hpp:63
GeographicLib::LambertConformalConic::Deatanhe
real Deatanhe(real x, real y) const
Definition: LambertConformalConic.hpp:133
GeographicLib::LambertConformalConic::Flattening
Math::real Flattening() const
Definition: LambertConformalConic.hpp:291
GeographicLib::LambertConformalConic::real
Math::real real
Definition: LambertConformalConic.hpp:65
lon
static const double lon
Definition: testGeographicLib.cpp:34
GeographicLib::Math::eatanhe
static T eatanhe(T x, T es)
Definition: Math.cpp:21
cx
const double cx
Definition: testSmartStereoFactor_iSAM2.cpp:49
sinh
const EIGEN_DEVICE_FUNC SinhReturnType sinh() const
Definition: ArrayCwiseUnaryOps.h:339
GeographicLib::Math::sq
static T sq(T x)
Definition: Math.hpp:232
align_3::t
Point2 t(10, 10)
GeographicLib::Math::hypot
static T hypot(T x, T y)
Definition: Math.hpp:243
real
Definition: main.h:100
ceres::sqrt
Jet< T, N > sqrt(const Jet< T, N > &f)
Definition: jet.h:418
GeographicLib::LambertConformalConic::Reverse
void Reverse(real lon0, real x, real y, real &lat, real &lon) const
Definition: LambertConformalConic.hpp:272
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:39