File: example-Geodesic3.cpp

package info (click to toggle)
geographiclib 2.7-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,572 kB
  • sloc: cpp: 27,765; sh: 5,463; makefile: 695; python: 12; ansic: 10
file content (27 lines) | stat: -rw-r--r-- 777 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// Example of using the Triaxial::Geodesic3 class.

#include <iostream>
#include <iomanip>
#include <exception>
#include <GeographicLib/Triaxial/Geodesic3.hpp>

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    Triaxial::Geodesic3 g(Triaxial::Ellipsoid3::Earth());
    double bet1 = 10, omg1 = 30, bet2 = 80, omg2 = -50,
      alp1, alp2, s12;
    g.Inverse(bet1, omg1, bet2, omg2, s12, alp1, alp2);
    cout << "geodesic between [" << bet1 << "," << omg1 << "] and ["
         << bet2 << "," << omg2 << "]\n";
    cout << fixed << setprecision(3)
         << "s12 = " << s12 << ", alp1 = "
         << alp1 << ", alp2 = " << alp2 << "\n";
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
}