Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
NETGeographicLib::Rhumb Class Reference

.NET wrapper for GeographicLib::Rhumb. More...

#include <Rhumb.h>

Public Types

enum  mask {
  mask::NONE, mask::LATITUDE, mask::LONGITUDE, mask::AZIMUTH,
  mask::DISTANCE, mask::AREA, mask::LONG_UNROLL, mask::ALL
}
 

Public Member Functions

void Direct (double lat1, double lon1, double azi12, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2)
 
void Direct (double lat1, double lon1, double azi12, double s12, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12)
 
void GenDirect (double lat1, double lon1, double azi12, double s12, Rhumb::mask outmask, [System::Runtime::InteropServices::Out] double% lat2, [System::Runtime::InteropServices::Out] double% lon2, [System::Runtime::InteropServices::Out] double% S12)
 
void GenInverse (double lat1, double lon1, double lat2, double lon2, Rhumb::mask outmask, [System::Runtime::InteropServices::Out] double% s12, [System::Runtime::InteropServices::Out] double% azi12, [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)
 
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)
 
RhumbLine Line (double lat1, double lon1, double azi12)
 
 Rhumb (double a, double f, bool exact)
 
 ~Rhumb ()
 The destructor calls the finalizer. More...
 

Private Member Functions

 !Rhumb (void)
 

Private Attributes

GeographicLib::Rhumbm_pRhumb
 

Inspector functions.

property double MajorRadius { double get()
 
property double Flattening { double get()
 
property double EllipsoidArea { double get()
 
System::IntPtr GetUnmanaged ()
 
static Rhumb WGS84 ()
 

Detailed Description

.NET wrapper for GeographicLib::Rhumb.

This class allows .NET applications to access GeographicLib::Rhumb.

Solve of the direct and inverse rhumb problems.

The path of constant azimuth between two points on a ellipsoid at (lat1, lon1) and (lat2, lon2) is called the rhumb line (also called the loxodrome). Its length is s12 and its azimuth is azi12. (The azimuth is the heading measured clockwise from north.)

Given lat1, lon1, azi12, and s12, we can determine lat2, and lon2. This is the direct rhumb problem and its solution is given by the function Rhumb::Direct.

Given lat1, lon1, lat2, and lon2, we can determine azi12 and s12. This is the inverse rhumb problem, whose solution is given by Rhumb::Inverse. This finds the shortest such rhumb line, i.e., the one that wraps no more than half way around the earth. If the end points are on opposite meridians, there are two shortest rhumb lines and the east-going one is chosen.

These routines also optionally calculate the area under the rhumb line, S12. This is the area, measured counter-clockwise, of the rhumb line quadrilateral with corners (lat1,lon1), (0,lon1), (0,lon2), and (lat2,lon2).

Note that rhumb lines may be appreciably longer (up to 50%) than the corresponding Geodesic. For example the distance between London Heathrow and Tokyo Narita via the rhumb line is 11400 km which is 18% longer than the geodesic distance 9600 km.

For more information on rhumb lines see rhumb.

For more information on rhumb lines see rhumb.

C# Example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace example_Rhumb
{
class Program
{
static void Main(string[] args)
{
try {
Rhumb rhumb = new Rhumb(Constants.WGS84.MajorRadius, Constants.WGS84.Flattening, true);
// Alternatively: const Rhumb& rhumb = Rhumb::WGS84();
{
// Sample direct calculation, travelling about NE from JFK
double lat1 = 40.6, lon1 = -73.8, s12 = 5.5e6, azi12 = 51;
double lat2, lon2;
rhumb.Direct(lat1, lon1, azi12, s12, out lat2, out lon2);
Console.WriteLine( "{0} {1}", lat2, lon2 );
}
{
// Sample inverse calculation, JFK to LHR
double
lat1 = 40.6, lon1 = -73.8, // JFK Airport
lat2 = 51.6, lon2 = -0.5; // LHR Airport
double s12, azi12;
rhumb.Inverse(lat1, lon1, lat2, lon2, out s12, out azi12);
Console.WriteLine( "{0} {1}", s12, azi12 );
}
}
catch (GeographicErr e) {
Console.WriteLine(String.Format("Caught exception: {0}", e.Message));
}
}
}
}

Managed C++ Example:

// Example of using the GeographicLib::Rhumb class
#include <iostream>
#include <exception>
using namespace std;
using namespace GeographicLib;
int main() {
try {
Rhumb rhumb(Constants::WGS84_a(), Constants::WGS84_f());
// Alternatively: const Rhumb& rhumb = Rhumb::WGS84();
{
// Sample direct calculation, travelling about NE from JFK
double lat1 = 40.6, lon1 = -73.8, s12 = 5.5e6, azi12 = 51;
double lat2, lon2;
rhumb.Direct(lat1, lon1, azi12, s12, lat2, lon2);
cout << lat2 << " " << lon2 << "\n";
}
{
// Sample inverse calculation, JFK to LHR
double
lat1 = 40.6, lon1 = -73.8, // JFK Airport
lat2 = 51.6, lon2 = -0.5; // LHR Airport
double s12, azi12;
rhumb.Inverse(lat1, lon1, lat2, lon2, s12, azi12);
cout << s12 << " " << azi12 << "\n";
}
}
catch (const exception& e) {
cerr << "Caught exception: " << e.what() << "\n";
return 1;
}
}

Visual Basic Example:

Imports NETGeographicLib
Module example_Rhumb
Sub Main()
Try
Dim rhumb As Rhumb = New Rhumb(Constants.WGS84.MajorRadius, Constants.WGS84.Flattening, True)
' Alternatively: const Rhumb& rhumb = Rhumb::WGS84();
' Sample direct calculation, travelling about NE from JFK
Dim lat1 As Double = 40.6, lon1 = -73.8, s12 = 5500000.0, azi12 = 51
Dim lat2 As Double, lon2
rhumb.Direct(lat1, lon1, azi12, s12, lat2, lon2)
Console.WriteLine("{0} {1}", lat2, lon2)
' Sample inverse calculation, JFK to LHR
lat1 = 40.6 : lon1 = -73.8 ' JFK Airport
lat2 = 51.6 : lon2 = -0.5 ' LHR Airport
rhumb.Inverse(lat1, lon1, lat2, lon2, s12, azi12)
Console.WriteLine("{0} {1}", s12, azi12)
Catch ex As GeographicErr
Console.WriteLine(String.Format("Caught exception: {0}", ex.Message))
End Try
End Sub
End Module

INTERFACE DIFFERENCES:
The MajorRadius and Flattening functions are implemented as properties.

Definition at line 65 of file Rhumb.h.

Member Enumeration Documentation

◆ mask

Bit masks for what calculations to do. They specify which results to return in the general routines Rhumb::GenDirect and Rhumb::GenInverse routines. RhumbLine::mask is a duplication of this enum.

Enumerator
NONE 

No output.

LATITUDE 

Calculate latitude lat2.

LONGITUDE 

Calculate longitude lon2.

AZIMUTH 

Calculate azimuth azi12.

DISTANCE 

Calculate distance s12.

AREA 

Calculate area S12.

LONG_UNROLL 

Unroll lon2 in the direct calculation.

ALL 

Calculate everything. (LONG_UNROLL is not included in this mask.)

Definition at line 78 of file Rhumb.h.

Constructor & Destructor Documentation

◆ !Rhumb()

Rhumb::!Rhumb ( void  )
private

Definition at line 19 of file dotnet/NETGeographicLib/Rhumb.cpp.

◆ Rhumb()

Rhumb::Rhumb ( double  a,
double  f,
bool  exact 
)

Constructor for a ellipsoid with

Parameters
[in]aequatorial radius (meters).
[in]fflattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid.
[in]exactif true (the default) use an addition theorem for elliptic integrals to compute divided differences; otherwise use series expansion (accurate for |f| < 0.01).
Exceptions
GeographicErrif a or (1 − f) a is not positive.

See rhumb, for a detailed description of the exact parameter.

Definition at line 29 of file dotnet/NETGeographicLib/Rhumb.cpp.

◆ ~Rhumb()

NETGeographicLib::Rhumb::~Rhumb ( )
inline

The destructor calls the finalizer.

Definition at line 140 of file Rhumb.h.

Member Function Documentation

◆ Direct() [1/2]

void Rhumb::Direct ( double  lat1,
double  lon1,
double  azi12,
double  s12,
[System::Runtime::InteropServices::Out] double%  lat2,
[System::Runtime::InteropServices::Out] double%  lon2 
)

Solve the direct rhumb problem without the area.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi12azimuth of the rhumb line (degrees).
[in]s12distance between point 1 and point 2 (meters); it can be negative.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees).

lat1 should be in the range [−90°, 90°]. The values of lon2 and azi2 returned are in the range [−180°, 180°).

If point 1 is a pole, the cosine of its latitude is taken to be 1/ε2 (where ε is 2-52). This position, which is extremely close to the actual pole, allows the calculation to be carried out in finite terms. If s12 is large enough that the rhumb line crosses a pole, the longitude of point 2 is indeterminate (a NaN is returned for lon2).

Definition at line 59 of file dotnet/NETGeographicLib/Rhumb.cpp.

◆ Direct() [2/2]

void Rhumb::Direct ( double  lat1,
double  lon1,
double  azi12,
double  s12,
[System::Runtime::InteropServices::Out] double%  lat2,
[System::Runtime::InteropServices::Out] double%  lon2,
[System::Runtime::InteropServices::Out] double%  S12 
)

Solve the direct rhumb problem returning also the area.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi12azimuth of the rhumb line (degrees).
[in]s12distance between point 1 and point 2 (meters); it can be negative.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees).
[out]S12area under the rhumb line (meters2).

lat1 should be in the range [−90°, 90°]. The value of lon2 returned is in the range [−180°, 180°).

If point 1 is a pole, the cosine of its latitude is taken to be 1/ε2 (where ε is 2-52). This position, which is extremely close to the actual pole, allows the calculation to be carried out in finite terms. If s12 is large enough that the rhumb line crosses a pole, the longitude of point 2 is indeterminate (a NaN is returned for lon2 and S12).

Definition at line 46 of file dotnet/NETGeographicLib/Rhumb.cpp.

◆ GenDirect()

void Rhumb::GenDirect ( double  lat1,
double  lon1,
double  azi12,
double  s12,
Rhumb::mask  outmask,
[System::Runtime::InteropServices::Out] double%  lat2,
[System::Runtime::InteropServices::Out] double%  lon2,
[System::Runtime::InteropServices::Out] double%  S12 
)

The general direct rhumb problem. Rhumb::Direct is defined in terms of this function.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi12azimuth of the rhumb line (degrees).
[in]s12distance between point 1 and point 2 (meters); it can be negative.
[in]outmaska bitor'ed combination of Rhumb::mask values specifying which of the following parameters should be set.
[out]lat2latitude of point 2 (degrees).
[out]lon2longitude of point 2 (degrees).
[out]S12area under the rhumb line (meters2).

The Rhumb::mask values possible for outmask are

  • outmask |= Rhumb.LATITUDE for the latitude lat2;
  • outmask |= Rhumb.LONGITUDE for the latitude lon2;
  • outmask |= Rhumb.AREA for the area S12;
  • outmask |= Rhumb:.ALL for all of the above;
  • outmask |= Rhumb.LONG_UNROLL to unroll lon2 instead of wrapping it into the range [−180°, 180°).

With the LONG_UNROLL bit set, the quantity lon2lon1 indicates how many times the rhumb line wrapped around the ellipsoid.

Definition at line 70 of file dotnet/NETGeographicLib/Rhumb.cpp.

◆ GenInverse()

void Rhumb::GenInverse ( double  lat1,
double  lon1,
double  lat2,
double  lon2,
Rhumb::mask  outmask,
[System::Runtime::InteropServices::Out] double%  s12,
[System::Runtime::InteropServices::Out] double%  azi12,
[System::Runtime::InteropServices::Out] double%  S12 
)

The general inverse rhumb problem. Rhumb::Inverse is defined in terms of this function.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]lat2latitude of point 2 (degrees).
[in]lon2longitude of point 2 (degrees).
[in]outmaska bitor'ed combination of Rhumb::mask values specifying which of the following parameters should be set.
[out]s12rhumb distance between point 1 and point 2 (meters).
[out]azi12azimuth of the rhumb line (degrees).
[out]S12area under the rhumb line (meters2).

The Rhumb::mask values possible for outmask are

  • outmask |= Rhumb::DISTANCE for the latitude s12;
  • outmask |= Rhumb::AZIMUTH for the latitude azi12;
  • outmask |= Rhumb::AREA for the area S12;
  • outmask |= Rhumb::ALL for all of the above;

Definition at line 109 of file dotnet/NETGeographicLib/Rhumb.cpp.

◆ GetUnmanaged()

System::IntPtr Rhumb::GetUnmanaged ( )

return The unmanaged pointer to the GeographicLib::Geodesic.

This function is for internal use only.

Definition at line 146 of file dotnet/NETGeographicLib/Rhumb.cpp.

◆ Inverse() [1/2]

void Rhumb::Inverse ( double  lat1,
double  lon1,
double  lat2,
double  lon2,
[System::Runtime::InteropServices::Out] double%  s12,
[System::Runtime::InteropServices::Out] double%  azi12 
)

Solve the inverse rhumb problem without the area.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]lat2latitude of point 2 (degrees).
[in]lon2longitude of point 2 (degrees).
[out]s12rhumb distance between point 1 and point 2 (meters).
[out]azi12azimuth of the rhumb line (degrees).

The shortest rhumb line is found. lat1 and lat2 should be in the range [−90°, 90°]. The value of azi12 returned is in the range [−180°, 180°).

If either point is a pole, the cosine of its latitude is taken to be 1/ε2 (where ε is 2-52). This position, which is extremely close to the actual pole, allows the calculation to be carried out in finite terms.

Definition at line 98 of file dotnet/NETGeographicLib/Rhumb.cpp.

◆ Inverse() [2/2]

void Rhumb::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 
)

Solve the inverse rhumb problem returning also the area.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]lat2latitude of point 2 (degrees).
[in]lon2longitude of point 2 (degrees).
[out]s12rhumb distance between point 1 and point 2 (meters).
[out]azi12azimuth of the rhumb line (degrees).
[out]S12area under the rhumb line (meters2).

The shortest rhumb line is found. If the end points are on opposite meridians, there are two shortest rhumb lines and the east-going one is chosen. lat1 and lat2 should be in the range [−90°, 90°]. The value of azi12 returned is in the range [−180°, 180°).

If either point is a pole, the cosine of its latitude is taken to be 1/ε2 (where ε is 2-52). This position, which is extremely close to the actual pole, allows the calculation to be carried out in finite terms.

Definition at line 85 of file dotnet/NETGeographicLib/Rhumb.cpp.

◆ Line()

RhumbLine Rhumb::Line ( double  lat1,
double  lon1,
double  azi12 
)

Set up to compute several points on a single rhumb line.

Parameters
[in]lat1latitude of point 1 (degrees).
[in]lon1longitude of point 1 (degrees).
[in]azi12azimuth of the rhumb line (degrees).
Returns
a RhumbLine object.

lat1 should be in the range [−90°, 90°].

If point 1 is a pole, the cosine of its latitude is taken to be 1/ε2 (where ε is 2-52). This position, which is extremely close to the actual pole, allows the calculation to be carried out in finite terms.

Definition at line 124 of file dotnet/NETGeographicLib/Rhumb.cpp.

◆ WGS84()

Rhumb Rhumb::WGS84 ( )
static

A global instantiation of Rhumb with the parameters for the WGS84 ellipsoid.

Definition at line 139 of file dotnet/NETGeographicLib/Rhumb.cpp.

Member Data Documentation

◆ EllipsoidArea

property double NETGeographicLib::Rhumb::EllipsoidArea { double get()
Returns
the area of the ellipsoid.

Definition at line 339 of file Rhumb.h.

◆ Flattening

property double NETGeographicLib::Rhumb::Flattening { double get()
Returns
f the flattening of the ellipsoid. This is the value used in the constructor.

Definition at line 334 of file Rhumb.h.

◆ m_pRhumb

GeographicLib::Rhumb* NETGeographicLib::Rhumb::m_pRhumb
private

Definition at line 68 of file Rhumb.h.

◆ MajorRadius

property double NETGeographicLib::Rhumb::MajorRadius { double get()
Returns
the equatorial radius of the ellipsoid (meters). This is the value used in the constructor.

Definition at line 328 of file Rhumb.h.


The documentation for this class was generated from the following files:
e
Array< double, 1, 3 > e(1./3., 0.5, 2.)
GeographicLib
Namespace for GeographicLib.
Definition: JacobiConformal.hpp:15
GeographicLib::Rhumb
Solve of the direct and inverse rhumb problems.
Definition: Rhumb.hpp:66
Rhumb.hpp
Header for GeographicLib::Rhumb and GeographicLib::RhumbLine classes.
main
int main(int argc, char **argv)
Definition: cmake/example_cmake_find_gtsam/main.cpp:63
NETGeographicLib::Rhumb::Rhumb
Rhumb(double a, double f, bool exact)
Definition: dotnet/NETGeographicLib/Rhumb.cpp:29
Constants.hpp
Header for GeographicLib::Constants class.
out
std::ofstream out("Result.txt")
std
Definition: BFloat16.h:88
args
Definition: pytypes.h:2210
NETGeographicLib
Definition: Accumulator.h:13


gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:25:01