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 }
GeographicLib::GravityCircle
Gravity on a circle of latitude.
Definition: GravityCircle.hpp:41
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
main
int main()
Definition: examples/example-GravityCircle.cpp:11
h
const double h
Definition: testSimpleHelicopter.cpp:19
GravityModel.hpp
Header for GeographicLib::GravityModel class.
GravityCircle.hpp
Header for GeographicLib::GravityCircle class.
GeographicLib::GravityModel::Gravity
Math::real Gravity(real lat, real lon, real h, real &gx, real &gy, real &gz) const
Definition: src/GravityModel.cpp:289
example::lon0
const double lon0
Definition: testGPSFactor.cpp:41
GeographicLib::GravityCircle::Gravity
Math::real Gravity(real lon, real &gx, real &gy, real &gz) const
Definition: src/GravityCircle.cpp:19
std
Definition: BFloat16.h:88
GeographicLib::GravityModel::Circle
GravityCircle Circle(real lat, real h, unsigned caps=ALL) const
Definition: src/GravityModel.cpp:307
lon
static const double lon
Definition: testGeographicLib.cpp:34
GeographicLib::GravityModel
Model of the earth's gravity field.
Definition: GravityModel.hpp:83
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Mon Jul 1 2024 03:01:15