Geocentric.hpp
Go to the documentation of this file.
1 
10 #if !defined(GEOGRAPHICLIB_GEOCENTRIC_HPP)
11 #define GEOGRAPHICLIB_GEOCENTRIC_HPP 1
12 
13 #include <vector>
15 
16 namespace GeographicLib {
17 
68  private:
69  typedef Math::real real;
70  friend class LocalCartesian;
71  friend class MagneticCircle; // MagneticCircle uses Rotation
72  friend class MagneticModel; // MagneticModel uses IntForward
73  friend class GravityCircle; // GravityCircle uses Rotation
74  friend class GravityModel; // GravityModel uses IntForward
75  friend class NormalGravity; // NormalGravity uses IntForward
76  static const size_t dim_ = 3;
77  static const size_t dim2_ = dim_ * dim_;
78  real _a, _f, _e2, _e2m, _e2a, _e4a, _maxrad;
79  static void Rotation(real sphi, real cphi, real slam, real clam,
80  real M[dim2_]);
81  static void Rotate(real M[dim2_], real x, real y, real z,
82  real& X, real& Y, real& Z) {
83  // Perform [X,Y,Z]^t = M.[x,y,z]^t
84  // (typically local cartesian to geocentric)
85  X = M[0] * x + M[1] * y + M[2] * z;
86  Y = M[3] * x + M[4] * y + M[5] * z;
87  Z = M[6] * x + M[7] * y + M[8] * z;
88  }
89  static void Unrotate(real M[dim2_], real X, real Y, real Z,
90  real& x, real& y, real& z) {
91  // Perform [x,y,z]^t = M^t.[X,Y,Z]^t
92  // (typically geocentric to local cartesian)
93  x = M[0] * X + M[3] * Y + M[6] * Z;
94  y = M[1] * X + M[4] * Y + M[7] * Z;
95  z = M[2] * X + M[5] * Y + M[8] * Z;
96  }
97  void IntForward(real lat, real lon, real h, real& X, real& Y, real& Z,
98  real M[dim2_]) const;
99  void IntReverse(real X, real Y, real Z, real& lat, real& lon, real& h,
100  real M[dim2_]) const;
101 
102  public:
103 
113  Geocentric(real a, real f);
114 
118  Geocentric() : _a(-1) {}
119 
133  const {
134  if (Init())
135  IntForward(lat, lon, h, X, Y, Z, NULL);
136  }
137 
162  std::vector<real>& M)
163  const {
164  if (!Init())
165  return;
166  if (M.end() == M.begin() + dim2_) {
167  real t[dim2_];
168  IntForward(lat, lon, h, X, Y, Z, t);
169  std::copy(t, t + dim2_, M.begin());
170  } else
171  IntForward(lat, lon, h, X, Y, Z, NULL);
172  }
173 
195  const {
196  if (Init())
197  IntReverse(X, Y, Z, lat, lon, h, NULL);
198  }
199 
224  std::vector<real>& M)
225  const {
226  if (!Init())
227  return;
228  if (M.end() == M.begin() + dim2_) {
229  real t[dim2_];
230  IntReverse(X, Y, Z, lat, lon, h, t);
231  std::copy(t, t + dim2_, M.begin());
232  } else
233  IntReverse(X, Y, Z, lat, lon, h, NULL);
234  }
235 
238 
242  bool Init() const { return _a > 0; }
248  { return Init() ? _a : Math::NaN(); }
249 
255  { return Init() ? _f : Math::NaN(); }
257 
262  static const Geocentric& WGS84();
263  };
264 
265 } // namespace GeographicLib
266 
267 #endif // GEOGRAPHICLIB_GEOCENTRIC_HPP
GeographicLib::Geocentric::Init
bool Init() const
Definition: Geocentric.hpp:242
GeographicLib::Geocentric::MajorRadius
Math::real MajorRadius() const
Definition: Geocentric.hpp:247
GeographicLib::GravityCircle
Gravity on a circle of latitude.
Definition: GravityCircle.hpp:41
GeographicLib::Math::NaN
static T NaN()
Definition: Math.hpp:830
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
gtsam::Y
GaussianFactorGraphValuePair Y
Definition: HybridGaussianProductFactor.cpp:29
GeographicLib::Geocentric::Reverse
void Reverse(real X, real Y, real Z, real &lat, real &lon, real &h) const
Definition: Geocentric.hpp:194
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
GeographicLib::MagneticModel
Model of the earth's magnetic field.
Definition: MagneticModel.hpp:69
GeographicLib::Geocentric::Rotate
static void Rotate(real M[dim2_], real x, real y, real z, real &X, real &Y, real &Z)
Definition: Geocentric.hpp:81
X
#define X
Definition: icosphere.cpp:20
GEOGRAPHICLIB_EXPORT
#define GEOGRAPHICLIB_EXPORT
Definition: Constants.hpp:91
h
const double h
Definition: testSimpleHelicopter.cpp:19
GeographicLib::Geocentric
Geocentric coordinates
Definition: Geocentric.hpp:67
GeographicLib::Geocentric::Forward
void Forward(real lat, real lon, real h, real &X, real &Y, real &Z) const
Definition: Geocentric.hpp:132
GeographicLib::Math::real
double real
Definition: Math.hpp:129
GeographicLib::NormalGravity
The normal gravity of the earth.
Definition: NormalGravity.hpp:79
GeographicLib::Geocentric::real
Math::real real
Definition: Geocentric.hpp:69
GeographicLib::Geocentric::Forward
void Forward(real lat, real lon, real h, real &X, real &Y, real &Z, std::vector< real > &M) const
Definition: Geocentric.hpp:161
pybind_wrapper_test_script.z
z
Definition: pybind_wrapper_test_script.py:61
Constants.hpp
Header for GeographicLib::Constants class.
y
Scalar * y
Definition: level1_cplx_impl.h:124
tree::f
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Definition: testExpression.cpp:218
a
ArrayXXi a
Definition: Array_initializer_list_23_cxx11.cpp:1
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
GeographicLib::Geocentric::Reverse
void Reverse(real X, real Y, real Z, real &lat, real &lon, real &h, std::vector< real > &M) const
Definition: Geocentric.hpp:223
GeographicLib::Geocentric::Flattening
Math::real Flattening() const
Definition: Geocentric.hpp:254
GeographicLib::LocalCartesian
Local cartesian coordinates.
Definition: LocalCartesian.hpp:38
lon
static const double lon
Definition: testGeographicLib.cpp:34
NULL
#define NULL
Definition: ccolamd.c:609
GeographicLib::Geocentric::Geocentric
Geocentric()
Definition: Geocentric.hpp:118
align_3::t
Point2 t(10, 10)
Z
#define Z
Definition: icosphere.cpp:21
GeographicLib::GravityModel
Model of the earth's gravity field.
Definition: GravityModel.hpp:83
real
Definition: main.h:100
GeographicLib::MagneticCircle
Geomagnetic field on a circle of latitude.
Definition: MagneticCircle.hpp:37
lat
static const double lat
Definition: testGeographicLib.cpp:34
GeographicLib::Geocentric::_maxrad
real _maxrad
Definition: Geocentric.hpp:78
M
Matrix< RealScalar, Dynamic, Dynamic > M
Definition: bench_gemm.cpp:51


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:36