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
static T NaN()
Definition: Math.hpp:830
Math::real V(real slam, real clam, real &gX, real &gY, real &gZ) const
Matrix< RealScalar, Dynamic, Dynamic > M
Definition: bench_gemm.cpp:51
Definition: BFloat16.h:88
static void sincosd(T x, T &sinx, T &cosx)
Definition: Math.hpp:558
Key W(std::uint64_t j)
Math::real W(real slam, real clam, real &gX, real &gY, real &gZ) const
Eigen::Triplet< double > T
Math::real Gravity(real lon, real &gx, real &gy, real &gz) const
Math::real Disturbance(real lon, real &deltax, real &deltay, real &deltaz) const
Definition: main.h:100
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Namespace for GeographicLib.
static T degree()
Definition: Math.hpp:216
void SphericalAnomaly(real lon, real &Dg01, real &xi, real &eta) const
static const double r3
Header for GeographicLib::Geocentric class.
Vector xi
Definition: testPose2.cpp:148
static const size_t dim2_
Definition: Geocentric.hpp:77
static void Unrotate(real M[dim2_], real X, real Y, real Z, real &x, real &y, real &z)
Definition: Geocentric.hpp:89
static void Rotation(real sphi, real cphi, real slam, real clam, real M[dim2_])
static const double lon
Math::real InternalT(real slam, real clam, real &deltaX, real &deltaY, real &deltaZ, bool gradp, bool correct) const
Header for GeographicLib::GravityCircle class.
Math::real GeoidHeight(real lon) const


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:19