dotnet/examples/ManagedCPP/example-GeodesicLineExact.cpp
Go to the documentation of this file.
1 using namespace System;
2 using namespace NETGeographicLib;
3 
5 {
6  try {
7  // Print waypoints between JFK and SIN
8  GeodesicExact^ geod = gcnew GeodesicExact(); // WGS84
9  double
10  lat1 = 40.640, lon1 = -73.779, // JFK
11  lat2 = 1.359, lon2 = 103.989; // SIN
12  double s12, azi1, azi2,
13  a12 = geod->Inverse(lat1, lon1, lat2, lon2, s12, azi1, azi2);
14  GeodesicLineExact^ line = gcnew GeodesicLineExact(geod, lat1, lon1, azi1, Mask::ALL);
15  // Alternatively
16  // const GeographicLib::GeodesicLine line = geod.Line(lat1, lon1, azi1);
17  double ds0 = 500e3; // Nominal distance between points = 500 km
18  int num = int(Math::Ceiling(s12 / ds0)); // The number of intervals
19  {
20  // Use intervals of equal length
21  double ds = s12 / num;
22  for (int i = 0; i <= num; ++i) {
23  double lat, lon;
24  line->Position(i * ds, lat, lon);
25  Console::WriteLine( String::Format( "i: {0} Latitude: {1} Longitude: {2}", i, lat, lon ));
26  }
27  }
28  {
29  // Slightly faster, use intervals of equal arc length
30  double da = a12 / num;
31  for (int i = 0; i <= num; ++i) {
32  double lat, lon;
33  line->ArcPosition(i * da, lat, lon);
34  Console::WriteLine( String::Format( "i: {0} Latitude: {1} Longitude: {2}", i, lat, lon ));
35  }
36  }
37  }
38  catch (GeographicErr^ e) {
39  Console::WriteLine(String::Format("Caught exception: {0}", e->Message));
40  return -1;
41  }
42  return 0;
43 }
int main(array< System::String^>^)
double Position(double s12, [System::Runtime::InteropServices::Out] double%lat2, [System::Runtime::InteropServices::Out] double%lon2, [System::Runtime::InteropServices::Out] double%azi2, [System::Runtime::InteropServices::Out] double%m12, [System::Runtime::InteropServices::Out] double%M12, [System::Runtime::InteropServices::Out] double%M21, [System::Runtime::InteropServices::Out] double%S12)
return int(ret)+1
static const double lat
Exception class for NETGeographicLib.
Definition: numpy.h:543
void ArcPosition(double a12, [System::Runtime::InteropServices::Out] double%lat2, [System::Runtime::InteropServices::Out] double%lon2, [System::Runtime::InteropServices::Out] double%azi2, [System::Runtime::InteropServices::Out] double%s12, [System::Runtime::InteropServices::Out] double%m12, [System::Runtime::InteropServices::Out] double%M12, [System::Runtime::InteropServices::Out] double%M21, [System::Runtime::InteropServices::Out] double%S12)
double Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double%s12, [System::Runtime::InteropServices::Out] double%azi1, [System::Runtime::InteropServices::Out] double%azi2, [System::Runtime::InteropServices::Out] double%m12, [System::Runtime::InteropServices::Out] double%M12, [System::Runtime::InteropServices::Out] double%M21, [System::Runtime::InteropServices::Out] double%S12)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
.NET wrapper for GeographicLib::GeodesicLineExact.
.NET wrapper for GeographicLib::GeodesicExact.
Definition: GeodesicExact.h:86
static const double lon


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