examples/example-GARS.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::GARS class
2 
3 #include <iostream>
4 #include <iomanip>
5 #include <exception>
6 #include <string>
7 #include <GeographicLib/GARS.hpp>
8 
9 using namespace std;
10 using namespace GeographicLib;
11 
12 int main() {
13  try {
14  {
15  // Sample forward calculation
16  double lat = 57.64911, lon = 10.40744; // Jutland
17  string gars;
18  for (int prec = 0; prec <= 2; ++prec) {
19  GARS::Forward(lat, lon, prec, gars);
20  cout << prec << " " << gars << "\n";
21  }
22  }
23  {
24  // Sample reverse calculation
25  string gars = "381NH45";
26  double lat, lon;
27  cout << fixed;
28  for (int len = 5; len <= int(gars.size()); ++len) {
29  int prec;
30  GARS::Reverse(gars.substr(0, len), lat, lon, prec);
31  cout << prec << " " << lat << " " << lon << "\n";
32  }
33  }
34  }
35  catch (const exception& e) {
36  cerr << "Caught exception: " << e.what() << "\n";
37  return 1;
38  }
39 }
Eigen::Forward
@ Forward
Definition: NumericalDiff.h:19
gtsam.examples.DogLegOptimizerExample.int
int
Definition: DogLegOptimizerExample.py:111
GARS.hpp
Header for GeographicLib::GARS class.
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-GARS.cpp:12
std
Definition: BFloat16.h:88
len
size_t len(handle h)
Get the length of a Python object.
Definition: pytypes.h:2446
lon
static const double lon
Definition: testGeographicLib.cpp:34
lat
static const double lat
Definition: testGeographicLib.cpp:34


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