dotnet/examples/ManagedCPP/example-RhumbLine.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  Rhumb^ rhumb = gcnew Rhumb(Constants::WGS84::MajorRadius, Constants::WGS84::Flattening, true);
9  // Alternatively: const Rhumb& rhumb = Rhumb::WGS84();
10  double
11  lat1 = 40.640, lon1 = -73.779, // JFK
12  lat2 = 1.359, lon2 = 103.989; // SIN
13  double s12, azi12;
14  rhumb->Inverse(lat1, lon1, lat2, lon2, s12, azi12);
15  RhumbLine^ line = rhumb->Line(lat1, lon1, azi12);
16  // Alternatively
17  // const GeographicLib::RhumbLine line = rhumb.Line(lat1, lon1, azi1);
18  double ds0 = 500e3; // Nominal distance between points = 500 km
19  int num = int(Math::Ceiling(s12 / ds0)); // The number of intervals
20  {
21  // Use intervals of equal length
22  double ds = s12 / num;
23  for (int i = 0; i <= num; ++i) {
24  double lat, lon;
25  line->Position(i * ds, lat, lon);
26  Console::WriteLine( "{0} {1} {2}", i, lat, lon );
27  }
28  }
29  }
30  catch (GeographicErr^ e) {
31  Console::WriteLine(String::Format("Caught exception: {0}", e->Message));
32  return -1;
33  }
34  return 0;
35 }
static const double lat
Exception class for NETGeographicLib.
int main(array< System::String ^> ^)
Definition: numpy.h:680
.NET wrapper for GeographicLib::RhumbLine.
Definition: Rhumb.h:374
Array< double, 1, 3 > e(1./3., 0.5, 2.)
RhumbLine Line(double lat1, double lon1, double azi12)
.NET wrapper for GeographicLib::Rhumb.
Definition: Rhumb.h:65
static const double lon
void Position(double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12)
void Inverse(double lat1, double lon1, double lat2, double lon2, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi12, [System::Runtime::InteropServices::Out] double% S12)


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