examples/example-GravityCircle.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::GravityCircle class
2 
3 #include <iostream>
4 #include <exception>
7 
8 using namespace std;
9 using namespace GeographicLib;
10 
11 int main() {
12  try {
13  GravityModel grav("egm96");
14  double lat = 27.99, lon0 = 86.93, h = 8820; // Mt Everest
15  {
16  // Slow method of evaluating the values at several points on a circle of
17  // latitude.
18  for (int i = -5; i <= 5; ++i) {
19  double lon = lon0 + i * 0.2;
20  double gx, gy, gz;
21  grav.Gravity(lat, lon, h, gx, gy, gz);
22  cout << lon << " " << gx << " " << gy << " " << gz << "\n";
23  }
24  }
25  {
26  // Fast method of evaluating the values at several points on a circle of
27  // latitude using GravityCircle.
28  GravityCircle circ = grav.Circle(lat, h);
29  for (int i = -5; i <= 5; ++i) {
30  double lon = lon0 + i * 0.2;
31  double gx, gy, gz;
32  circ.Gravity(lon, gx, gy, gz);
33  cout << lon << " " << gx << " " << gy << " " << gz << "\n";
34  }
35  }
36  }
37  catch (const exception& e) {
38  cerr << "Caught exception: " << e.what() << "\n";
39  return 1;
40  }
41 }
static const double lat
Definition: BFloat16.h:88
Header for GeographicLib::GravityModel class.
Math::real Gravity(real lat, real lon, real h, real &gx, real &gy, real &gz) const
Math::real Gravity(real lon, real &gx, real &gy, real &gz) const
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
const double lon0
Model of the earth&#39;s gravity field.
const double h
GravityCircle Circle(real lat, real h, unsigned caps=ALL) const
static const double lon
Header for GeographicLib::GravityCircle class.
Gravity on a circle of latitude.


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