dotnet/examples/ManagedCPP/example-Geocentric.cpp
Go to the documentation of this file.
1 using namespace System;
2 using namespace NETGeographicLib;
3 
5 {
6  try {
7  Geocentric^ earth = gcnew Geocentric( Constants::WGS84::MajorRadius,
8  Constants::WGS84::Flattening);
9  // Alternatively: Geocentric earth = new Geocentric();
10  {
11  // Sample forward calculation
12  double lat = 27.99, lon = 86.93, h = 8820; // Mt Everest
13  double X, Y, Z;
14  earth->Forward(lat, lon, h, X, Y, Z);
15  Console::WriteLine( String::Format( "{0} {1} {2}",
16  Math::Floor(X / 1000 + 0.5),
17  Math::Floor(Y / 1000 + 0.5),
18  Math::Floor(Z / 1000 + 0.5) ) );
19  }
20  {
21  // Sample reverse calculation
22  double X = 302e3, Y = 5636e3, Z = 2980e3;
23  double lat, lon, h;
24  earth->Reverse(X, Y, Z, lat, lon, h);
25  Console::WriteLine(String::Format("{0} {1} {2}", lat, lon, h));
26  }
27  }
28  catch (GeographicErr^ e) {
29  Console::WriteLine( String::Format( "Caught exception: {0}", e->Message ) );
30  return -1;
31  }
32  return 0;
33 }
int main(array< System::String^>^)
static const double lat
Exception class for NETGeographicLib.
Definition: numpy.h:543
.NET wrapper for GeographicLib::Geocentric.
Definition: Geocentric.h:68
#define Z
Definition: icosphere.cpp:21
Array< double, 1, 3 > e(1./3., 0.5, 2.)
const double h
void Forward(double lat, double lon, double h, [System::Runtime::InteropServices::Out] double%X, [System::Runtime::InteropServices::Out] double%Y, [System::Runtime::InteropServices::Out] double%Z)
static const double lon
void Reverse(double X, double Y, double Z, [System::Runtime::InteropServices::Out] double%lat, [System::Runtime::InteropServices::Out] double%lon, [System::Runtime::InteropServices::Out] double%h)
#define X
Definition: icosphere.cpp:20


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