examples/example-PolygonArea.cpp
Go to the documentation of this file.
1 // Example of using the GeographicLib::PolygonArea class
2 
3 #include <iostream>
4 #include <exception>
8 
9 using namespace std;
10 using namespace GeographicLib;
11 
12 int main() {
13  try {
14  Geodesic geod(Constants::WGS84_a(), Constants::WGS84_f());
15  // Alternatively: const Geodesic& geod = Geodesic::WGS84();
16  PolygonArea poly(geod);
17  poly.AddPoint( 52, 0); // London
18  poly.AddPoint( 41,-74); // New York
19  poly.AddPoint(-23,-43); // Rio de Janeiro
20  poly.AddPoint(-26, 28); // Johannesburg
21  double perimeter, area;
22  unsigned n = poly.Compute(false, true, perimeter, area);
23  cout << n << " " << perimeter << " " << area << "\n";
24  }
25  catch (const exception& e) {
26  cerr << "Caught exception: " << e.what() << "\n";
27  return 1;
28  }
29 }
int n
Definition: Half.h:150
Header for GeographicLib::Geodesic class.
Namespace for GeographicLib.
Array< double, 1, 3 > e(1./3., 0.5, 2.)
Header for GeographicLib::PolygonAreaT class.
Header for GeographicLib::Constants class.
Geodesic calculations
Definition: Geodesic.hpp:172


gtsam
Author(s):
autogenerated on Sat May 8 2021 02:42:02