File: example-Conformal3.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 (31 lines) | stat: -rw-r--r-- 959 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
28
29
30
31
// Example of using the Triaxial::Conformal3 class.

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

using namespace std;
using namespace GeographicLib;

int main() {
  try {
    Triaxial::Conformal3 proj(Triaxial::Ellipsoid3::Earth());
    cout  << fixed << setprecision(1)
          << "Ellipsoid parameters: a = " << proj.t().a()
          << ", b = " << proj.t().b() << ", c = " << proj.t().c() << "\n"
          << setprecision(3)
          << "Quadrants: x = " << proj.x0() << ", y = " << proj.y0() << "\n";
    cout << "Coordinates angle (deg) x (m) y (m):\n";
    cout << setprecision(2);
    for (int i = -180; i <= 180; i += 15) {
      double omg = i + 90, bet = i,
        x = proj.x(Angle(omg)), y = proj.y(Angle(bet));
      cout << i << " " << x << " " << y << "\n";
    }
  }
  catch (const exception& e) {
    cerr << "Caught exception: " << e.what() << "\n";
    return 1;
  }
}