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 }
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
n
int n
Definition: BiCGSTAB_simple.cpp:1
PolygonArea.hpp
Header for GeographicLib::PolygonAreaT class.
Constants.hpp
Header for GeographicLib::Constants class.
std
Definition: BFloat16.h:88
main
int main()
Definition: examples/example-PolygonArea.cpp:12
GeographicLib::Geodesic
Geodesic calculations
Definition: Geodesic.hpp:172
Geodesic.hpp
Header for GeographicLib::Geodesic class.


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:11:31