examples/example-Rhumb.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::Rhumb class
2 
3 #include <iostream>
4 #include <exception>
7 
8 using namespace std;
9 using namespace GeographicLib;
10 
11 int main() {
12  try {
13  Rhumb rhumb(Constants::WGS84_a(), Constants::WGS84_f());
14  // Alternatively: const Rhumb& rhumb = Rhumb::WGS84();
15  {
16  // Sample direct calculation, travelling about NE from JFK
17  double lat1 = 40.6, lon1 = -73.8, s12 = 5.5e6, azi12 = 51;
18  double lat2, lon2;
19  rhumb.Direct(lat1, lon1, azi12, 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, azi12;
28  rhumb.Inverse(lat1, lon1, lat2, lon2, s12, azi12);
29  cout << s12 << " " << azi12 << "\n";
30  }
31  }
32  catch (const exception& e) {
33  cerr << "Caught exception: " << e.what() << "\n";
34  return 1;
35  }
36 }
Definition: BFloat16.h:88
Header for GeographicLib::Rhumb and GeographicLib::RhumbLine classes.
int main()
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
void Inverse(real lat1, real lon1, real lat2, real lon2, real &s12, real &azi12, real &S12) const
Definition: Rhumb.hpp:338
Header for GeographicLib::Constants class.
Solve of the direct and inverse rhumb problems.
Definition: Rhumb.hpp:66
void Direct(real lat1, real lon1, real azi12, real s12, real &lat2, real &lon2, real &S12) const
Definition: Rhumb.hpp:271


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