src/GravityCircle.cpp
Go to the documentation of this file.
1 
11 #include <fstream>
12 #include <sstream>
14 
15 namespace GeographicLib {
16 
17  using namespace std;
18 
20  real& gx, real& gy, real& gz) const {
21  real slam, clam, M[Geocentric::dim2_];
22  Math::sincosd(lon, slam, clam);
23  real Wres = W(slam, clam, gx, gy, gz);
24  Geocentric::Rotation(_sphi, _cphi, slam, clam, M);
25  Geocentric::Unrotate(M, gx, gy, gz, gx, gy, gz);
26  return Wres;
27  }
28 
30  real& deltaz) const {
31  real slam, clam, M[Geocentric::dim2_];
32  Math::sincosd(lon, slam, clam);
33  real Tres = InternalT(slam, clam, deltax, deltay, deltaz, true, true);
34  Geocentric::Rotation(_sphi, _cphi, slam, clam, M);
35  Geocentric::Unrotate(M, deltax, deltay, deltaz, deltax, deltay, deltaz);
36  return Tres;
37  }
38 
40  if ((_caps & GEOID_HEIGHT) != GEOID_HEIGHT)
41  return Math::NaN();
42  real slam, clam, dummy;
43  Math::sincosd(lon, slam, clam);
44  real T = InternalT(slam, clam, dummy, dummy, dummy, false, false);
45  real correction = _corrmult * _correction(slam, clam);
46  return T/_gamma0 + correction;
47  }
48 
50  real& Dg01, real& xi, real& eta) const {
51  if ((_caps & SPHERICAL_ANOMALY) != SPHERICAL_ANOMALY) {
52  Dg01 = xi = eta = Math::NaN();
53  return;
54  }
55  real slam, clam;
56  Math::sincosd(lon, slam, clam);
57  real
58  deltax, deltay, deltaz,
59  T = InternalT(slam, clam, deltax, deltay, deltaz, true, false);
60  // Rotate cartesian into spherical coordinates
62  Geocentric::Rotation(_spsi, _cpsi, slam, clam, MC);
63  Geocentric::Unrotate(MC, deltax, deltay, deltaz, deltax, deltay, deltaz);
64  // H+M, Eq 2-151c
65  Dg01 = - deltaz - 2 * T * _invR;
66  xi = -(deltay/_gamma) / Math::degree();
67  eta = -(deltax/_gamma) / Math::degree();
68  }
69 
71  real& gX, real& gY, real& gZ) const {
72  real Wres = V(slam, clam, gX, gY, gZ) + _frot * _Px / 2;
73  gX += _frot * clam;
74  gY += _frot * slam;
75  return Wres;
76  }
77 
79  real& GX, real& GY, real& GZ) const {
80  if ((_caps & GRAVITY) != GRAVITY) {
81  GX = GY = GZ = Math::NaN();
82  return Math::NaN();
83  }
84  real
85  Vres = _gravitational(slam, clam, GX, GY, GZ),
86  f = _GMmodel / _amodel;
87  Vres *= f;
88  GX *= f;
89  GY *= f;
90  GZ *= f;
91  return Vres;
92  }
93 
95  real& deltaX, real& deltaY, real& deltaZ,
96  bool gradp, bool correct) const {
97  if (gradp) {
98  if ((_caps & DISTURBANCE) != DISTURBANCE) {
99  deltaX = deltaY = deltaZ = Math::NaN();
100  return Math::NaN();
101  }
102  } else {
103  if ((_caps & DISTURBING_POTENTIAL) != DISTURBING_POTENTIAL)
104  return Math::NaN();
105  }
106  if (_dzonal0 == 0)
107  correct = false;
108  real T = (gradp
109  ? _disturbing(slam, clam, deltaX, deltaY, deltaZ)
110  : _disturbing(slam, clam));
111  T = (T / _amodel - (correct ? _dzonal0 : 0) * _invR) * _GMmodel;
112  if (gradp) {
113  real f = _GMmodel / _amodel;
114  deltaX *= f;
115  deltaY *= f;
116  deltaZ *= f;
117  if (correct) {
118  real r3 = _GMmodel * _dzonal0 * _invR * _invR * _invR;
119  deltaX += _Px * clam * r3;
120  deltaY += _Px * slam * r3;
121  deltaZ += _Z * r3;
122  }
123  }
124  return T;
125  }
126 
127 } // namespace GeographicLib
GeographicLib::GravityCircle::V
Math::real V(real slam, real clam, real &gX, real &gY, real &gZ) const
Definition: src/GravityCircle.cpp:78
GeographicLib::GravityCircle::W
Math::real W(real slam, real clam, real &gX, real &gY, real &gZ) const
Definition: src/GravityCircle.cpp:70
GeographicLib::Math::NaN
static T NaN()
Definition: Math.hpp:830
screwPose2::xi
Vector xi
Definition: testPose2.cpp:148
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
GeographicLib::GravityCircle::SphericalAnomaly
void SphericalAnomaly(real lon, real &Dg01, real &xi, real &eta) const
Definition: src/GravityCircle.cpp:49
GeographicLib::Math::sincosd
static void sincosd(T x, T &sinx, T &cosx)
Definition: Math.hpp:558
T
Eigen::Triplet< double > T
Definition: Tutorial_sparse_example.cpp:6
GeographicLib::GravityCircle::GeoidHeight
Math::real GeoidHeight(real lon) const
Definition: src/GravityCircle.cpp:39
pybind_wrapper_test_script.dummy
dummy
Definition: pybind_wrapper_test_script.py:42
GeographicLib::GravityCircle::InternalT
Math::real InternalT(real slam, real clam, real &deltaX, real &deltaY, real &deltaZ, bool gradp, bool correct) const
Definition: src/GravityCircle.cpp:94
GeographicLib::Math::real
double real
Definition: Math.hpp:129
GeographicLib::Math::degree
static T degree()
Definition: Math.hpp:216
GravityCircle.hpp
Header for GeographicLib::GravityCircle class.
Geocentric.hpp
Header for GeographicLib::Geocentric class.
r3
static const double r3
Definition: testSmartRangeFactor.cpp:32
Eigen::Triplet< double >
tree::f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Definition: testExpression.cpp:218
GeographicLib::Geocentric::dim2_
static const size_t dim2_
Definition: Geocentric.hpp:77
GeographicLib::GravityCircle::Gravity
Math::real Gravity(real lon, real &gx, real &gy, real &gz) const
Definition: src/GravityCircle.cpp:19
GeographicLib::Geocentric::Unrotate
static void Unrotate(real M[dim2_], real X, real Y, real Z, real &x, real &y, real &z)
Definition: Geocentric.hpp:89
gtsam.examples.CombinedImuFactorExample.GRAVITY
float GRAVITY
Definition: CombinedImuFactorExample.py:29
GeographicLib::GravityCircle::Disturbance
Math::real Disturbance(real lon, real &deltax, real &deltay, real &deltaz) const
Definition: src/GravityCircle.cpp:29
gtsam::symbol_shorthand::W
Key W(std::uint64_t j)
Definition: inference/Symbol.h:170
std
Definition: BFloat16.h:88
GeographicLib::Geocentric::Rotation
static void Rotation(real sphi, real cphi, real slam, real clam, real M[dim2_])
Definition: src/Geocentric.cpp:155
V
MatrixXcd V
Definition: EigenSolver_EigenSolver_MatrixType.cpp:15
lon
static const double lon
Definition: testGeographicLib.cpp:34
real
Definition: main.h:100
M
Matrix< RealScalar, Dynamic, Dynamic > M
Definition: bench_gemm.cpp:51


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