|
GeographicLib 2.6
|
Transformations between Cartesian and triaxial coordinates. More...
#include <GeographicLib/Triaxial/Cartesian3.hpp>
Public Types | |
| enum | coord { GEODETIC , PARAMETRIC , GEOCENTRIC , ELLIPSOIDAL , GEODETIC_X , PARAMETRIC_X , GEOCENTRIC_X , PLANETODETIC , GEOGRAPHIC , PLANETOCENTRIC } |
| using | vec3 = Ellipsoid3::vec3 |
Public Member Functions | |
| template<int n> | |
| Angle | meridianplane (ang lam, bool alt) const |
Transformations for points on the ellipsoid. | |
| Cartesian3 (const Ellipsoid3 &t) | |
| Cartesian3 (real a, real b, real c) | |
| Cartesian3 (real b, real e2, real k2, real kp2) | |
| void | anytocart2 (coord coordin, Angle lat, Angle lon, vec3 &R) const |
| void | anytocart2 (coord coordin, real lat, real lon, vec3 &R) const |
| void | cart2toany (vec3 R, coord coordout, Angle &lat, Angle &lon) const |
| void | cart2toany (vec3 R, coord coordout, real &lat, real &lon) const |
| void | anytoany (coord coordin, Angle lat1, Angle lon1, coord coordout, Angle &lat2, Angle &lon2) const |
| void | anytoany (coord coordin, real lat1, real lon1, coord coordout, real &lat2, real &lon2) const |
Transformations for points and directions on the ellipsoid. | |
| void | anytocart2 (coord coordin, Angle lat, Angle lon, Angle azi, vec3 &R, vec3 &V) const |
| void | anytocart2 (coord coordin, real lat, real lon, real azi, vec3 &R, vec3 &V) const |
| void | cart2toany (vec3 R, vec3 V, coord coordout, Angle &lat, Angle &lon, Angle &azi) const |
| void | cart2toany (vec3 R, vec3 V, coord coordout, real &lat, real &lon, real &azi) const |
Transformations for arbitrary points. | |
| void | anytocart (coord coordin, Angle lat, Angle lon, real h, vec3 &R) const |
| void | anytocart (coord coordin, real lat, real lon, real h, vec3 &R) const |
| void | carttoany (vec3 R, coord coordout, Angle &lat, Angle &lon, real &h) const |
| void | carttoany (vec3 R, coord coordout, real &lat, real &lon, real &h) const |
Transferring an arbitrary point onto the ellipsoid. | |
| void | cart2tocart (vec3 R2, real h, vec3 &R) const |
| void | carttocart2 (vec3 R, vec3 &R2, real &h) const |
Generating random points on the ellipsoid. | |
| template<class G> | |
| void | cart2rand (G &g, vec3 &R) const |
| template<class G> | |
| void | cart2rand (G &g, vec3 &R, vec3 &V) const |
Inspector function | |
| const Ellipsoid3 & | t () const |
Transformations between Cartesian and triaxial coordinates.
The Cartesian3 class supports transformations between cartesian coordinates and various coordinates for a triaxial ellipsoid. Besides ellipsoidal coordinates defined in Ellipsoid3, the following coordinates are supported:
\[ \hat{\mathbf U} = [\cos\phi \cos\lambda, \cos\phi \sin\lambda, \sin\phi]^T, \]
where \(\hat{\mathbf U}\) is the normal to the surface of the ellipsoid.\[ \mathbf R = [a \cos\phi' \cos\lambda', b \cos\phi' \sin\lambda', c \sin\phi']^T, \]
\[ \hat{\mathbf R} = [\cos\phi'' \cos\lambda'', \cos\phi'' \sin\lambda'', \sin\phi'']^T. \]
For each of thses 3 coordinates, the "north pole" is at \([0, 0, c]^T\) and the origin for longitudes is \([a, 0, 0]^T\). We also define alternate versions (named "geodetic*", etc., where the north pole is placed at \([a, 0, 0]^T\) and the origin for longitude is \([0, 0, -c]\). This latter set of coordinates is appropriate for ellipsoids that are nearly prolate.
Directions on the ellipsoid are easily specified in Cartesian coordinates as a vector tangent to the surface of the ellipsoid. This is converted to a heading by defined the angle the vector makes (measured clockwise) from the coordinate-specific north. This is defined as the direction of a line of constant (coordinate-specific) longitude. The resulting heading is denoted by \(\alpha\) for ellopsoidal coordinates and by \(\zeta\) for the other coordinates. The unstarred coordinates all share the same direction for north, and likewise for the starred coordinates. Note that the lines of constant longitude and latitude are only orthogonal (in general) for ellipsoidal coordinates.
Arbitrary points (not necessarily lying on the ellipsoid) an additional "height" is required to specify the position. For ellipsoidal coordinates, we find the confocal ellipsoid on which the point lies and the height is then defined as \(H = u - c\) where \(u\) is the semiminor axes of the confocal ellipsoid; the ellipsoid latitude and longitude are those for the confocal ellipsoid For the other coordinates systems, we define \(h\) a the height above the closest point on the ellipsoid and the latitude and longitude refer to the closest point.
Example of use:
Cart3Convert is a command-line utility providing access to the functionality of Cartestian3.
Definition at line 94 of file Cartesian3.hpp.
A type to hold three-dimentional positions and directions in Cartesian coordinates.
Definition at line 100 of file Cartesian3.hpp.
Enumerator for all the coordinates.
Definition at line 185 of file Cartesian3.hpp.
| GeographicLib::Triaxial::Cartesian3::Cartesian3 | ( | const Ellipsoid3 & | t | ) |
Constructor for a triaxial ellipsoid defined by Ellipsoid3 object.
| [in] | t | the Ellipsoid3 object. |
Definition at line 17 of file Cartesian3.cpp.
References t().
Referenced by Cartesian3(), and Cartesian3().
| GeographicLib::Triaxial::Cartesian3::Cartesian3 | ( | real | a, |
| real | b, | ||
| real | c ) |
Constructor for a trixial ellipsoid with semi-axes.
| [in] | a | the largest semi-axis. |
| [in] | b | the middle semi-axis. |
| [in] | c | the smallest semi-axis. |
| GeographicErr | if the required ordering is semiaxes is violated. |
The semi-axes must satisfy a ≥ b ≥ c > 0. If a = c (a sphere), then the oblate limit is taken.
Definition at line 27 of file Cartesian3.cpp.
References Cartesian3().
| GeographicLib::Triaxial::Cartesian3::Cartesian3 | ( | real | b, |
| real | e2, | ||
| real | k2, | ||
| real | kp2 ) |
Alternate constructor for a triaxial ellipsoid.
| [in] | b | the middle semi-axis. |
| [in] | e2 | the eccentricity squared \(e^2 = (a^2 - c^2)/b^2\). |
| [in] | k2 | the oblateness parameter squared \(k^2 = (b^2 - c^2) / (a^2 - c^2)\). |
| [in] | kp2 | the prolateness parameter squared \(k'^2= (a^2 - b^2) / (a^2 - c^2)\). |
| GeographicErr | if the required ordering is semiaxes is violated. |
Definition at line 31 of file Cartesian3.cpp.
References Cartesian3().
| void GeographicLib::Triaxial::Cartesian3::anytocart2 | ( | coord | coordin, |
| Angle | lat, | ||
| Angle | lon, | ||
| vec3 & | R ) const |
Convert latitude and longitude to a point on the surface.
| [in] | coordin | one of the coordinate types, Cartesian3::coord. |
| [in] | lat | the latitude of the point. |
| [in] | lon | the longitude of the point. |
| [out] | R | the Cartesian position on the surface of the ellipsoid. |
| GeographicErr | if coordin is not recognized. |
Definition at line 273 of file Cartesian3.cpp.
References ELLIPSOIDAL, GEOCENTRIC, GEOCENTRIC_X, GEODETIC, GEODETIC_X, PARAMETRIC, and PARAMETRIC_X.
Referenced by anytoany(), anytocart(), anytocart2(), and anytocart2().
|
inline |
Convert latitude and longitude in degrees to a point on the surface.
| [in] | coordin | one of the coordinate types, Cartesian3::coord. |
| [in] | lat | the latitude of the point (in degrees). |
| [in] | lon | the longitude of the point (in degrees). |
| [out] | R | the Cartesian position on the surface of the ellipsoid. |
| GeographicErr | if coordin is not recognized. |
Definition at line 299 of file Cartesian3.hpp.
References anytocart2().
| void GeographicLib::Triaxial::Cartesian3::cart2toany | ( | vec3 | R, |
| coord | coordout, | ||
| Angle & | lat, | ||
| Angle & | lon ) const |
Convert a point on the surface to latitude and longitude.
| [in] | R | the Cartesian position on the surface of the ellipsoid. |
| [in] | coordout | one of the coordinate types, Cartesian3::coord. |
| [out] | lat | the latitude of the point. |
| [out] | lon | the longitude of the point. |
| GeographicErr | if coordout is not recognized. |
Definition at line 253 of file Cartesian3.cpp.
References ELLIPSOIDAL, GEOCENTRIC, GEOCENTRIC_X, GEODETIC, GEODETIC_X, PARAMETRIC, and PARAMETRIC_X.
Referenced by anytoany(), cart2toany(), cart2toany(), and carttoany().
|
inline |
Convert a point on the surface to latitude and longitude in degrees.
| [in] | R | the Cartesian position on the surface of the ellipsoid. |
| [in] | coordout | one of the coordinate types, Cartesian3::coord. |
| [out] | lat | the latitude of the point (in degrees). |
| [out] | lon | the longitude of the point (in degrees). |
| GeographicErr | if coordout is not recognized. |
Definition at line 321 of file Cartesian3.hpp.
References cart2toany().
| void GeographicLib::Triaxial::Cartesian3::anytoany | ( | coord | coordin, |
| Angle | lat1, | ||
| Angle | lon1, | ||
| coord | coordout, | ||
| Angle & | lat2, | ||
| Angle & | lon2 ) const |
Convert between latitudes and longitudes.
| [in] | coordin | one of the coordinate types, Cartesian3::coord. |
| [in] | lat1 | the coordin latitude of the point. |
| [in] | lon1 | the coordin longitude of the point. |
| [in] | coordout | one of the coordinate types, Cartesian3::coord. |
| [out] | lat2 | the coordout latitude of the point. |
| [out] | lon2 | the coordout longitude of the point. |
| GeographicErr | if coordin or coordout is not recognized. |
Definition at line 293 of file Cartesian3.cpp.
References anytocart2(), and cart2toany().
Referenced by anytoany().
|
inline |
Convert between latitudes and longitudes in degrees.
| [in] | coordin | one of the coordinate types, Cartesian3::coord. |
| [in] | lat1 | the coordin latitude of the point (in degrees). |
| [in] | lon1 | the coordin longitude of the point (in degrees). |
| [in] | coordout | one of the coordinate types, Cartesian3::coord. |
| [out] | lat2 | the coordout latitude of the point (in degrees). |
| [out] | lon2 | the coordout longitude of the point (in degrees). |
| GeographicErr | if coordin or coordout is not recognized. |
Definition at line 349 of file Cartesian3.hpp.
References anytoany().
| void GeographicLib::Triaxial::Cartesian3::anytocart2 | ( | coord | coordin, |
| Angle | lat, | ||
| Angle | lon, | ||
| Angle | azi, | ||
| vec3 & | R, | ||
| vec3 & | V ) const |
Convert latitiude, longitude, and azimuth to Cartesian position and direction.
| [in] | coordin | one of the coordinate types, Cartesian3::coord. |
| [in] | lat | the latitude of the point. |
| [in] | lon | the longitude of the point. |
| [in] | azi | the azimuth of the heading. |
| [out] | R | the Cartesian position on the surface of the ellipsoid. |
| [out] | V | the Cartesian direction tangent to the ellipsoid. |
| GeographicErr | if coordin is not recognized. |
Definition at line 320 of file Cartesian3.cpp.
References ELLIPSOIDAL, GEOCENTRIC, GEOCENTRIC_X, GEODETIC, GEODETIC_X, PARAMETRIC, and PARAMETRIC_X.
|
inline |
Convert latitiude, longitude, and azimuth in degrees to Cartesian position and direction.
| [in] | coordin | one of the coordinate types, Cartesian3::coord. |
| [in] | lat | the latitude of the point (in degrees). |
| [in] | lon | the longitude of the point (in degrees). |
| [in] | azi | the azimuth of the heading (in degrees). |
| [out] | R | the Cartesian position on the surface of the ellipsoid. |
| [out] | V | the Cartesian direction tangent to the ellipsoid. |
| GeographicErr | if coordin is not recognized. |
Definition at line 386 of file Cartesian3.hpp.
References anytocart2().
| void GeographicLib::Triaxial::Cartesian3::cart2toany | ( | vec3 | R, |
| vec3 | V, | ||
| coord | coordout, | ||
| Angle & | lat, | ||
| Angle & | lon, | ||
| Angle & | azi ) const |
Convert position and direction on surface to latitiude, longitude, and azimuth.
| [in] | R | the Cartesian position on the surface of the ellipsoid. |
| [in] | V | the Cartesian direction tangent to the ellipsoid. |
| [in] | coordout | one of the coordinate types, Cartesian3::coord. |
| [out] | lat | the latitude of the point. |
| [out] | lon | the longitude of the point. |
| [out] | azi | the azimuth of the heading. |
| GeographicErr | if coordout is not recognized. |
Definition at line 300 of file Cartesian3.cpp.
References ELLIPSOIDAL, GEOCENTRIC, GEOCENTRIC_X, GEODETIC, GEODETIC_X, PARAMETRIC, and PARAMETRIC_X.
|
inline |
Convert position and direction on surface to latitiude, longitude, and azimuth in degrees.
| [in] | R | the Cartesian position on the surface of the ellipsoid. |
| [in] | V | the Cartesian direction tangent to the ellipsoid. |
| [in] | coordout | one of the coordinate types, Cartesian3::coord. |
| [out] | lat | the latitude of the point (in degrees). |
| [out] | lon | the longitude of the point (in degrees). |
| [out] | azi | the azimuth of the heading (in degrees). |
| GeographicErr | if coordout is not recognized. |
Definition at line 416 of file Cartesian3.hpp.
References cart2toany().
| void GeographicLib::Triaxial::Cartesian3::anytocart | ( | coord | coordin, |
| Angle | lat, | ||
| Angle | lon, | ||
| real | h, | ||
| vec3 & | R ) const |
Convert latitiude, longitude, and height to a Cartesian position.
| [in] | coordin | one of the coordinate types, Cartesian3::coord. |
| [in] | lat | the latitude of the point. |
| [in] | lon | the longitude of the point. |
| [in] | h | the height (in meters). |
| [out] | R | the Cartesian position of the point. |
| GeographicErr | if coordin is not recognized. |
Definition at line 351 of file Cartesian3.cpp.
References anytocart2(), cart2tocart(), and ELLIPSOIDAL.
Referenced by anytocart().
|
inline |
Convert latitiude, longitude in degrees, and height to a Cartesian position.
| [in] | coordin | one of the coordinate types, Cartesian3::coord. |
| [in] | lat | the latitude of the point (in degrees). |
| [in] | lon | the longitude of the point (in degrees). |
| [in] | h | the height (in meters). |
| [out] | R | the Cartesian position of the point. |
| GeographicErr | if coordin is not recognized. |
Definition at line 448 of file Cartesian3.hpp.
References anytocart().
| void GeographicLib::Triaxial::Cartesian3::carttoany | ( | vec3 | R, |
| coord | coordout, | ||
| Angle & | lat, | ||
| Angle & | lon, | ||
| real & | h ) const |
Convert a Cartesian position to latitiude, longitude, and height.
| [in] | R | the Cartesian position of the point. |
| [in] | coordout | one of the coordinate types, Cartesian3::coord. |
| [out] | lat | the latitude of the point. |
| [out] | lon | the longitude of the point. |
| [out] | h | the height (in meters). |
| GeographicErr | if coordin is not recognized. |
Definition at line 340 of file Cartesian3.cpp.
References cart2toany(), carttocart2(), and ELLIPSOIDAL.
Referenced by carttoany().
|
inline |
Convert a Cartesian position to latitiude, longitude in degrees, and height.
| [in] | R | the Cartesian position of the point. |
| [in] | coordout | one of the coordinate types, Cartesian3::coord. |
| [out] | lat | the latitude of the point (in degrees). |
| [out] | lon | the longitude of the point (in degrees). |
| [out] | h | the height (in meters). |
| GeographicErr | if coordin is not recognized. |
Definition at line 474 of file Cartesian3.hpp.
References carttoany().
Convert a point on the ellipsoid and a height to a Cartesian position.
| [in] | R2 | the Cartesian position of the point on the ellipsoid. |
| [in] | h | the height above the ellipsoid (in meters). |
| [out] | R | the Cartesian position of the point. |
Definition at line 362 of file Cartesian3.cpp.
References GeographicLib::Math::hypot3().
Referenced by anytocart().
Find the closest point on the ellipsoid
| [in] | R | the Cartesian position of the point. |
| [out] | R2 | the Cartesian position of the closest point on the ellipsoid. |
| [out] | h | the height above the ellipsoid (in meters). |
Definition at line 370 of file Cartesian3.cpp.
References GeographicLib::Math::hypot3(), and GeographicLib::Math::sq().
Referenced by carttoany().
|
inline |
Generate a random point on the ellipsoid.
| G | the type of the random generator. |
| [in] | g | the random generator. |
| [out] | R | a Cartesian position uniformly sampled on the surface of the ellipsoid. |
See the example listed in the description of this class for an example of using this function.
The method of sampling is given by Marples and Williams (2023) Algorithm 1, based on the general method of Williamson (1987).
Definition at line 547 of file Cartesian3.hpp.
References GeographicLib::Math::hypot3().
Referenced by cart2rand().
|
inline |
Generate a random point and direction on the ellipsoid.
| G | the type of the random generator. |
| [in] | g | the random generator. |
| [out] | R | a Cartesian position uniformly sampled on the surface of the ellipsoid. |
| [out] | V | a Cartesian direction uniformly sampled tangent to the ellipsoid. |
Definition at line 565 of file Cartesian3.hpp.
References cart2rand(), and GeographicLib::Math::sq().
|
inline |
Definition at line 543 of file Cartesian3.hpp.
Referenced by Cartesian3().
| Angle GeographicLib::Triaxial::Cartesian3::meridianplane | ( | ang | lam, |
| bool | alt ) const |
Definition at line 199 of file Cartesian3.cpp.
References GeographicLib::AngleT< T >::modang().