src/MagneticCircle.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 
19  void MagneticCircle::Field(real lon, bool diffp,
20  real& Bx, real& By, real& Bz,
21  real& Bxt, real& Byt, real& Bzt) const {
22  real slam, clam;
23  Math::sincosd(lon, slam, clam);
25  Geocentric::Rotation(_sphi, _cphi, slam, clam, M);
26  real BX0, BY0, BZ0, BX1, BY1, BZ1; // Components in geocentric basis
27  real BXc = 0, BYc = 0, BZc = 0;
28  _circ0(slam, clam, BX0, BY0, BZ0);
29  _circ1(slam, clam, BX1, BY1, BZ1);
30  if (_constterm)
31  _circ2(slam, clam, BXc, BYc, BZc);
32  if (_interpolate) {
33  BX1 = (BX1 - BX0) / _dt0;
34  BY1 = (BY1 - BY0) / _dt0;
35  BZ1 = (BZ1 - BZ0) / _dt0;
36  }
37  BX0 += _t1 * BX1 + BXc;
38  BY0 += _t1 * BY1 + BYc;
39  BZ0 += _t1 * BZ1 + BZc;
40  if (diffp) {
41  Geocentric::Unrotate(M, BX1, BY1, BZ1, Bxt, Byt, Bzt);
42  Bxt *= - _a;
43  Byt *= - _a;
44  Bzt *= - _a;
45  }
46  Geocentric::Unrotate(M, BX0, BY0, BZ0, Bx, By, Bz);
47  Bx *= - _a;
48  By *= - _a;
49  Bz *= - _a;
50  }
51 
52 } // namespace GeographicLib
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
GeographicLib::Math::sincosd
static void sincosd(T x, T &sinx, T &cosx)
Definition: Math.hpp:558
GeographicLib::MagneticCircle::Field
void Field(real lon, bool diffp, real &Bx, real &By, real &Bz, real &Bxt, real &Byt, real &Bzt) const
Definition: src/MagneticCircle.cpp:19
Geocentric.hpp
Header for GeographicLib::Geocentric class.
GeographicLib::Geocentric::dim2_
static const size_t dim2_
Definition: Geocentric.hpp:77
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
MagneticCircle.hpp
Header for GeographicLib::MagneticCircle class.
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
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:44