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 }
gtsam.examples.DogLegOptimizerExample.int
int
Definition: DogLegOptimizerExample.py:111
NETGeographicLib::GeodesicLine::Position
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)
Definition: dotnet/NETGeographicLib/GeodesicLine.cpp:78
NETGeographicLib::Geodesic::Inverse
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)
Definition: dotnet/NETGeographicLib/Geodesic.cpp:323
NETGeographicLib::GeodesicLine
.NET wrapper for GeographicLib::GeodesicLine.
Definition: GeodesicLine.h:75
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
NETGeographicLib::GeographicErr
Exception class for NETGeographicLib.
Definition: NETGeographicLib.h:132
NETGeographicLib::Geodesic
.NET wrapper for GeographicLib::Geodesic.
Definition: Geodesic.h:170
array
Definition: numpy.h:821
main
int main(array< System::String ^> ^)
Definition: dotnet/examples/ManagedCPP/example-GeodesicLine.cpp:4
lon
static const double lon
Definition: testGeographicLib.cpp:34
NETGeographicLib::GeodesicLine::ArcPosition
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)
Definition: dotnet/NETGeographicLib/GeodesicLine.cpp:184
NETGeographicLib
Definition: Accumulator.h:13
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9
lat
static const double lat
Definition: testGeographicLib.cpp:34


gtsam
Author(s):
autogenerated on Thu Jul 4 2024 03:01:20