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 }
NETGeographicLib::Geocentric::Reverse
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)
Definition: dotnet/NETGeographicLib/Geocentric.cpp:107
main
int main(array< System::String ^> ^)
Definition: dotnet/examples/ManagedCPP/example-Geocentric.cpp:4
NETGeographicLib::Geocentric
.NET wrapper for GeographicLib::Geocentric.
Definition: Geocentric.h:68
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
gtsam::Y
GaussianFactorGraphValuePair Y
Definition: HybridGaussianProductFactor.cpp:29
X
#define X
Definition: icosphere.cpp:20
h
const double h
Definition: testSimpleHelicopter.cpp:19
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
array
Definition: numpy.h:821
lon
static const double lon
Definition: testGeographicLib.cpp:34
Z
#define Z
Definition: icosphere.cpp:21
NETGeographicLib::Geocentric::Forward
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)
Definition: dotnet/NETGeographicLib/Geocentric.cpp:75
NETGeographicLib
Definition: Accumulator.h:13
lat
static const double lat
Definition: testGeographicLib.cpp:34


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