dotnet/examples/ManagedCPP/example-GeodesicLine.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  Geodesic^ geod = gcnew Geodesic(); // 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  GeodesicLine^ line = gcnew GeodesicLine(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 }
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)
static const double lat
Exception class for NETGeographicLib.
Definition: numpy.h:680
.NET wrapper for GeographicLib::GeodesicLine.
Definition: GeodesicLine.h:75
.NET wrapper for GeographicLib::Geodesic.
Definition: Geodesic.h:170
int main(array< System::String ^> ^)
Array< double, 1, 3 > e(1./3., 0.5, 2.)
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)
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)
static const double lon


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:12