.NET wrapper for GeographicLib::Geocentric. More...
#include <Geocentric.h>
Public Member Functions | |
void | Forward (double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% X, [System::Runtime::InteropServices::Out] double% Y, [System::Runtime::InteropServices::Out] double% Z) |
void | Forward (double lat, double lon, double h, [System::Runtime::InteropServices::Out] double% X, [System::Runtime::InteropServices::Out] double% Y, [System::Runtime::InteropServices::Out] double% Z, [System::Runtime::InteropServices::Out] array< double, 2 >^% M) |
Geocentric () | |
Geocentric (const GeographicLib::Geocentric &g) | |
Geocentric (double a, double f) | |
void | Reverse (double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% h) |
void | Reverse (double X, double Y, double Z, [System::Runtime::InteropServices::Out] double% lat, [System::Runtime::InteropServices::Out] double% lon, [System::Runtime::InteropServices::Out] double% h, [System::Runtime::InteropServices::Out] array< double, 2 >^% M) |
~Geocentric () | |
Private Member Functions | |
!Geocentric () | |
Private Attributes | |
const GeographicLib::Geocentric * | m_pGeocentric |
Inspector functions | |
property double | MajorRadius { double get() |
property double | Flattening { double get() |
System::IntPtr | GetUnmanaged () |
.NET wrapper for GeographicLib::Geocentric.
This class allows .NET applications to access GeographicLib::Geocentric.
Convert between geodetic coordinates latitude = lat, longitude = lon, height = h (measured vertically from the surface of the ellipsoid) to geocentric coordinates (X, Y, Z). The origin of geocentric coordinates is at the center of the earth. The Z axis goes thru the north pole, lat = 90°. The X axis goes thru lat = 0, lon = 0. Geocentric coordinates are also known as earth centered, earth fixed (ECEF) coordinates.
The conversion from geographic to geocentric coordinates is straightforward. For the reverse transformation we use
Several changes have been made to ensure that the method returns accurate results for all finite inputs (even if h is infinite). The changes are described in Appendix B of
See geocentric for more information.
The errors in these routines are close to round-off. Specifically, for points within 5000 km of the surface of the ellipsoid (either inside or outside the ellipsoid), the error is bounded by 7 nm (7 nanometers) for the WGS84 ellipsoid. See geocentric for further information on the errors.
C# Example:
Managed C++ Example:
Visual Basic Example:
INTERFACE DIFFERENCES:
A default constructor is provided that assumes WGS84 parameters.
The MajorRadius and Flattening functions are implemented as properties.
The Forward and Reverse functions return rotation matrices as 2D, 3 × 3 arrays rather than vectors.
Definition at line 68 of file Geocentric.h.
|
private |
Definition at line 21 of file dotnet/NETGeographicLib/Geocentric.cpp.
Geocentric::Geocentric | ( | double | a, |
double | f | ||
) |
Constructor for a ellipsoid with
[in] | a | equatorial radius (meters). |
[in] | f | flattening of ellipsoid. Setting f = 0 gives a sphere. Negative f gives a prolate ellipsoid. |
GeographicErr | if a or (1 − f ) a is not positive. |
Definition at line 45 of file dotnet/NETGeographicLib/Geocentric.cpp.
Geocentric::Geocentric | ( | ) |
A default constructor which assumes WGS84.
Definition at line 31 of file dotnet/NETGeographicLib/Geocentric.cpp.
Geocentric::Geocentric | ( | const GeographicLib::Geocentric & | g | ) |
A constructor that is initialized from an unmanaged GeographicLib::Geocentric. For internal use only.
[in] | g | An existing GeographicLib::Geocentric. |
Definition at line 62 of file dotnet/NETGeographicLib/Geocentric.cpp.
|
inline |
The destructor calls the finalizer.
Definition at line 103 of file Geocentric.h.
void Geocentric::Forward | ( | double | lat, |
double | lon, | ||
double | h, | ||
[System::Runtime::InteropServices::Out] double% | X, | ||
[System::Runtime::InteropServices::Out] double% | Y, | ||
[System::Runtime::InteropServices::Out] double% | Z | ||
) |
Convert from geodetic to geocentric coordinates.
[in] | lat | latitude of point (degrees). |
[in] | lon | longitude of point (degrees). |
[in] | h | height of point above the ellipsoid (meters). |
[out] | X | geocentric coordinate (meters). |
[out] | Y | geocentric coordinate (meters). |
[out] | Z | geocentric coordinate (meters). |
lat should be in the range [−90°, 90°].
Definition at line 75 of file dotnet/NETGeographicLib/Geocentric.cpp.
void Geocentric::Forward | ( | double | lat, |
double | lon, | ||
double | h, | ||
[System::Runtime::InteropServices::Out] double% | X, | ||
[System::Runtime::InteropServices::Out] double% | Y, | ||
[System::Runtime::InteropServices::Out] double% | Z, | ||
[System::Runtime::InteropServices::Out] array< double, 2 >^% | M | ||
) |
Convert from geodetic to geocentric coordinates and return rotation matrix.
[in] | lat | latitude of point (degrees). |
[in] | lon | longitude of point (degrees). |
[in] | h | height of point above the ellipsoid (meters). |
[out] | X | geocentric coordinate (meters). |
[out] | Y | geocentric coordinate (meters). |
[out] | Z | geocentric coordinate (meters). |
[out] | M | a 3 × 3 rotation matrix. |
Let v be a unit vector located at (lat, lon, h). We can express v as column vectors in one of two ways
Then we have v0 = M ⋅ v1.
Definition at line 88 of file dotnet/NETGeographicLib/Geocentric.cpp.
System::IntPtr Geocentric::GetUnmanaged | ( | ) |
Definition at line 139 of file dotnet/NETGeographicLib/Geocentric.cpp.
void Geocentric::Reverse | ( | double | X, |
double | Y, | ||
double | Z, | ||
[System::Runtime::InteropServices::Out] double% | lat, | ||
[System::Runtime::InteropServices::Out] double% | lon, | ||
[System::Runtime::InteropServices::Out] double% | h | ||
) |
Convert from geocentric to geodetic to coordinates.
[in] | X | geocentric coordinate (meters). |
[in] | Y | geocentric coordinate (meters). |
[in] | Z | geocentric coordinate (meters). |
[out] | lat | latitude of point (degrees). |
[out] | lon | longitude of point (degrees). |
[out] | h | height of point above the ellipsoid (meters). |
In general there are multiple solutions and the result which maximizes h is returned. If there are still multiple solutions with different latitudes (applies only if Z = 0), then the solution with lat > 0 is returned. If there are still multiple solutions with different longitudes (applies only if X = Y = 0) then lon = 0 is returned. The value of h returned satisfies h ≥ − a (1 − e2) / sqrt(1 − e2 sin2lat). The value of lon returned is in the range [−180°, 180°).
Definition at line 107 of file dotnet/NETGeographicLib/Geocentric.cpp.
void Geocentric::Reverse | ( | double | X, |
double | Y, | ||
double | Z, | ||
[System::Runtime::InteropServices::Out] double% | lat, | ||
[System::Runtime::InteropServices::Out] double% | lon, | ||
[System::Runtime::InteropServices::Out] double% | h, | ||
[System::Runtime::InteropServices::Out] array< double, 2 >^% | M | ||
) |
Convert from geocentric to geodetic to coordinates.
[in] | X | geocentric coordinate (meters). |
[in] | Y | geocentric coordinate (meters). |
[in] | Z | geocentric coordinate (meters). |
[out] | lat | latitude of point (degrees). |
[out] | lon | longitude of point (degrees). |
[out] | h | height of point above the ellipsoid (meters). |
[out] | M | a 3 × 3 rotation matrix. |
Let v be a unit vector located at (lat, lon, h). We can express v as column vectors in one of two ways
Then we have v1 = MT ⋅ v0, where MT is the transpose of M.
Definition at line 120 of file dotnet/NETGeographicLib/Geocentric.cpp.
property double NETGeographicLib::Geocentric::Flattening { double get() |
Definition at line 222 of file Geocentric.h.
|
private |
Definition at line 72 of file Geocentric.h.
property double NETGeographicLib::Geocentric::MajorRadius { double get() |
Definition at line 216 of file Geocentric.h.