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
Matrix< RealScalar, Dynamic, Dynamic > M
Definition: bench_gemm.cpp:38
Header for GeographicLib::MagneticCircle class.
Definition: Half.h:150
static void sincosd(T x, T &sinx, T &cosx)
Definition: Math.hpp:558
void Field(real lon, bool diffp, real &Bx, real &By, real &Bz, real &Bxt, real &Byt, real &Bzt) const
Namespace for GeographicLib.
Header for GeographicLib::Geocentric class.
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


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:35