examples/example-PolarStereographic.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::PolarStereographic class
2 
3 #include <iostream>
4 #include <iomanip>
5 #include <exception>
7 
8 using namespace std;
9 using namespace GeographicLib;
10 
11 int main() {
12  try {
13  PolarStereographic proj(Constants::WGS84_a(), Constants::WGS84_f(),
14  Constants::UPS_k0());
15  // Alternatively:
16  // const PolarStereographic& proj = PolarStereographic::UPS();
17  bool northp = true;
18  {
19  // Sample forward calculation
20  double lat = 61.2, lon = -149.9; // Anchorage
21  double x, y;
22  proj.Forward(northp, lat, lon, x, y);
23  cout << x << " " << y << "\n";
24  }
25  {
26  // Sample reverse calculation
27  double x = -1637e3, y = 2824e3;
28  double lat, lon;
29  proj.Reverse(northp, x, y, lat, lon);
30  cout << lat << " " << lon << "\n";
31  }
32  }
33  catch (const exception& e) {
34  cerr << "Caught exception: " << e.what() << "\n";
35  return 1;
36  }
37 }
PolarStereographic.hpp
Header for GeographicLib::PolarStereographic class.
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
GeographicLib::PolarStereographic::Reverse
void Reverse(bool northp, real x, real y, real &lat, real &lon, real &gamma, real &k) const
Definition: src/PolarStereographic.cpp:81
y
Scalar * y
Definition: level1_cplx_impl.h:124
GeographicLib::PolarStereographic
Polar stereographic projection.
Definition: PolarStereographic.hpp:36
std
Definition: BFloat16.h:88
main
int main()
Definition: examples/example-PolarStereographic.cpp:11
GeographicLib::PolarStereographic::Forward
void Forward(bool northp, real lat, real lon, real &x, real &y, real &gamma, real &k) const
Definition: src/PolarStereographic.cpp:61
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