16 #if !defined(GEOGRAPHICLIB_DATA) 18 # define GEOGRAPHICLIB_DATA "C:/ProgramData/GeographicLib" 20 # define GEOGRAPHICLIB_DATA "/usr/local/share/GeographicLib" 24 #if !defined(GEOGRAPHICLIB_GRAVITY_DEFAULT_NAME) 25 # define GEOGRAPHICLIB_GRAVITY_DEFAULT_NAME "egm96" 30 # pragma warning (disable: 4996) 40 , _description(
"NONE")
42 , _amodel(
Math::NaN())
43 , _GMmodel(
Math::NaN())
53 ifstream coeffstr(coeff.c_str(), ios::binary);
61 if (
_id !=
string(
id))
65 if (!(N >= 0 && M >= 0))
78 int pos =
int(coeffstr.tellg());
80 if (pos != coeffstr.tellg())
92 for (
int n = 2;
n <= nmx;
n += 2) {
120 const char* spaces =
" \t\n\v\f\r";
126 getline(metastr, line);
127 if (!(line.size() >= 6 && line.substr(0,5) ==
"EGMF-"))
129 string::size_type
n = line.find_first_of(spaces, 5);
130 if (n != string::npos)
137 while (getline(metastr, line)) {
143 else if (key ==
"Description")
145 else if (key ==
"ReleaseDate")
147 else if (key ==
"ModelRadius")
148 _amodel = Utility::val<real>(val);
149 else if (key ==
"ModelMass")
151 else if (key ==
"AngularVelocity")
152 omega = Utility::val<real>(val);
153 else if (key ==
"ReferenceRadius")
154 a = Utility::val<real>(val);
155 else if (key ==
"ReferenceMass")
156 GM = Utility::val<real>(val);
157 else if (key ==
"Flattening")
158 f = Utility::fract<real>(val);
159 else if (key ==
"DynamicalFormFactor")
160 J2 = Utility::fract<real>(val);
161 else if (key ==
"HeightOffset")
162 _zeta0 = Utility::fract<real>(val);
163 else if (key ==
"CorrectionMultiplier")
165 else if (key ==
"Normalization") {
166 if (val ==
"FULL" || val ==
"Full" || val ==
"full")
168 else if (val ==
"SCHMIDT" || val ==
"Schmidt" || val ==
"schmidt")
172 }
else if (key ==
"ByteOrder") {
173 if (val ==
"Big" || val ==
"big")
174 throw GeographicErr(
"Only little-endian ordering is supported");
175 else if (!(val ==
"Little" || val ==
"little"))
177 }
else if (key ==
"ID")
187 throw GeographicErr(
"Correction multiplier must be positive");
200 bool gradp,
bool correct)
const {
210 deltaX = deltaY = deltaZ = 0;
211 T =
_disturbing(-1, X, Y, Z, deltaX, deltaY, deltaZ);
243 Wres =
V(X, Y, Z, gX, gY, gZ) +
_earth.
Phi(X, Y, fX, fY);
254 deltax, deltay, deltaz,
255 T =
InternalT(X, Y, Z, deltax, deltay, deltaz,
true,
false),
256 clam = M[3], slam = -M[0],
260 cpsi =
R != 0 ? P /
R : M[7],
261 spsi =
R != 0 ? Z /
R : M[8];
267 Dg01 = - deltaz - 2 * T /
R;
268 real gammaX, gammaY, gammaZ;
269 _earth.
U(X, Y, Z, gammaX, gammaY, gammaZ);
286 return T/gamma0 + correction;
293 real Wres =
W(X, Y, Z, gx, gy, gz);
299 real& deltaz)
const {
302 real Tres =
InternalT(X, Y, Z, deltax, deltay, deltaz,
true,
true);
343 char* gravitypath = getenv(
"GEOGRAPHICLIB_GRAVITY_PATH");
345 path = string(gravitypath);
348 char* datapath = getenv(
"GEOGRAPHICLIB_DATA");
350 path = string(datapath);
356 char* gravityname = getenv(
"GEOGRAPHICLIB_GRAVITY_NAME");
358 name = string(gravityname);
const gtsam::Symbol key('X', 0)
Math::real T(real X, real Y, real Z, real &deltaX, real &deltaY, real &deltaZ) const
Matrix< RealScalar, Dynamic, Dynamic > M
SphericalHarmonic::normalization _norm
CircularEngine Circle(real tau, real p, real z, bool gradp) const
void ReadMetadata(const std::string &name)
Header for GeographicLib::Utility class.
The normal gravity of the earth.
static bool isfinite(T x)
Rot2 R(Rot2::fromAngle(0.1))
SphericalHarmonic _correction
Mathematical functions needed by GeographicLib.
Header for GeographicLib::GravityModel class.
const SphericalEngine::coeff & Coefficients() const
Math::real InternalT(real X, real Y, real Z, real &deltaX, real &deltaY, real &deltaZ, bool gradp, bool correct) const
static void readcoeffs(std::istream &stream, int &N, int &M, std::vector< real > &C, std::vector< real > &S)
Math::real MassConstant() const
#define GEOGRAPHICLIB_DATA
Math::real Gravity(real lat, real lon, real h, real &gx, real &gy, real &gz) const
CircularEngine Circle(real p, real z, bool gradp) const
friend class GravityCircle
Point2(* f)(const Point3 &, OptionalJacobian< 2, 3 >)
Namespace for GeographicLib.
void IntForward(real lat, real lon, real h, real &X, real &Y, real &Z, real M[dim2_]) const
Vector::Scalar omega(const Vector &t, const Vector &s, RealScalar angle)
Math::real Disturbance(real lat, real lon, real h, real &deltax, real &deltay, real &deltaz) const
Spherical harmonic sums for a circle.
Math::real SurfaceGravity(real lat) const
std::vector< real > _zonal
GravityModel(const GravityModel &)
static std::string DefaultGravityName()
GravityCircle Circle(real lat, real h, unsigned caps=ALL) const
static const size_t dim2_
Math::real V(real X, real Y, real Z, real &GX, real &GY, real &GZ) const
Exception handling for GeographicLib.
static std::string DefaultGravityPath()
static void Unrotate(real M[dim2_], real X, real Y, real Z, real &x, real &y, real &z)
static EIGEN_DEPRECATED const end_t end
static void Rotation(real sphi, real cphi, real slam, real clam, real M[dim2_])
Spherical harmonic series with a correction to the coefficients.
static const int idlength_
SphericalHarmonic1 _disturbing
SphericalHarmonic _gravitational
Jet< T, N > sqrt(const Jet< T, N > &f)
Annotation for function names.
Spherical harmonic series.
Math::real W(real X, real Y, real Z, real &gX, real &gY, real &gZ) const
Header for GeographicLib::GravityCircle class.
Math::real Phi(real X, real Y, real &fX, real &fY) const
static bool ParseLine(const std::string &line, std::string &key, std::string &val)
Header for GeographicLib::SphericalEngine class.
#define GEOGRAPHICLIB_GRAVITY_DEFAULT_NAME
void SphericalAnomaly(real lat, real lon, real h, real &Dg01, real &xi, real &eta) const
const Geocentric & Earth() const
Math::real U(real X, real Y, real Z, real &gammaX, real &gammaY, real &gammaZ) const
Gravity on a circle of latitude.
Math::real GeoidHeight(real lat, real lon) const