examples/example-GeodesicExact.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::GeodesicExact class
2 
3 #include <iostream>
4 #include <exception>
7 
8 using namespace std;
9 using namespace GeographicLib;
10 
11 int main() {
12  try {
13  GeodesicExact geod(Constants::WGS84_a(), Constants::WGS84_f());
14  // Alternatively: const GeodesicExact& geod = GeodesicExact::WGS84();
15  {
16  // Sample direct calculation, travelling about NE from JFK
17  double lat1 = 40.6, lon1 = -73.8, s12 = 5.5e6, azi1 = 51;
18  double lat2, lon2;
19  geod.Direct(lat1, lon1, azi1, s12, lat2, lon2);
20  cout << lat2 << " " << lon2 << "\n";
21  }
22  {
23  // Sample inverse calculation, JFK to LHR
24  double
25  lat1 = 40.6, lon1 = -73.8, // JFK Airport
26  lat2 = 51.6, lon2 = -0.5; // LHR Airport
27  double s12;
28  geod.Inverse(lat1, lon1, lat2, lon2, s12);
29  cout << s12 << "\n";
30  }
31  }
32  catch (const exception& e) {
33  cerr << "Caught exception: " << e.what() << "\n";
34  return 1;
35  }
36 }
GeographicLib::GeodesicExact
Exact geodesic calculations.
Definition: GeodesicExact.hpp:80
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
GeographicLib::GeodesicExact::Direct
Math::real Direct(real lat1, real lon1, real azi1, real s12, real &lat2, real &lon2, real &azi2, real &m12, real &M12, real &M21, real &S12) const
Definition: GeodesicExact.hpp:274
GeodesicExact.hpp
Header for GeographicLib::GeodesicExact class.
GeographicLib::GeodesicExact::Inverse
Math::real Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi1, real &azi2, real &m12, real &M12, real &M21, real &S12) const
Definition: GeodesicExact.hpp:565
Constants.hpp
Header for GeographicLib::Constants class.
std
Definition: BFloat16.h:88
main
int main()
Definition: examples/example-GeodesicExact.cpp:11


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:16