examples/example-AzimuthalEquidistant.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::AzimuthalEquidistant class
2 
3 #include <iostream>
4 #include <exception>
7 
8 using namespace std;
9 using namespace GeographicLib;
10 
11 int main() {
12  try {
13  Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f());
14  // Alternatively: const Geodesic& geod = Geodesic::WGS84();
15  const double lat0 = 48 + 50/60.0, lon0 = 2 + 20/60.0; // Paris
16  AzimuthalEquidistant proj(geod);
17  {
18  // Sample forward calculation
19  double lat = 50.9, lon = 1.8; // Calais
20  double x, y;
21  proj.Forward(lat0, lon0, lat, lon, x, y);
22  cout << x << " " << y << "\n";
23  }
24  {
25  // Sample reverse calculation
26  double x = -38e3, y = 230e3;
27  double lat, lon;
28  proj.Reverse(lat0, lon0, x, y, lat, lon);
29  cout << lat << " " << lon << "\n";
30  }
31  }
32  catch (const exception& e) {
33  cerr << "Caught exception: " << e.what() << "\n";
34  return 1;
35  }
36 }
GeographicLib::AzimuthalEquidistant::Forward
void Forward(real lat0, real lon0, real lat, real lon, real &x, real &y, real &azi, real &rk) const
Definition: src/AzimuthalEquidistant.cpp:20
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
x
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
Definition: gnuplot_common_settings.hh:12
AzimuthalEquidistant.hpp
Header for GeographicLib::AzimuthalEquidistant class.
example::lat0
const double lat0
Definition: testGPSFactor.cpp:41
example::lon0
const double lon0
Definition: testGPSFactor.cpp:41
main
int main()
Definition: examples/example-AzimuthalEquidistant.cpp:11
GeographicLib::AzimuthalEquidistant
Azimuthal equidistant projection.
Definition: AzimuthalEquidistant.hpp:42
y
Scalar * y
Definition: level1_cplx_impl.h:124
GeographicLib::AzimuthalEquidistant::Reverse
void Reverse(real lat0, real lon0, real x, real y, real &lat, real &lon, real &azi, real &rk) const
Definition: src/AzimuthalEquidistant.cpp:30
std
Definition: BFloat16.h:88
lon
static const double lon
Definition: testGeographicLib.cpp:34
GeographicLib::Geodesic
Geodesic calculations
Definition: Geodesic.hpp:172
Geodesic.hpp
Header for GeographicLib::Geodesic class.
lat
static const double lat
Definition: testGeographicLib.cpp:34


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