Local cartesian coordinates. More...
#include <LocalCartesian.hpp>
Public Member Functions | |
void | Forward (real lat, real lon, real h, real &x, real &y, real &z) const |
void | Forward (real lat, real lon, real h, real &x, real &y, real &z, std::vector< real > &M) const |
LocalCartesian (real lat0, real lon0, real h0=0, const Geocentric &earth=Geocentric::WGS84()) | |
LocalCartesian (const Geocentric &earth=Geocentric::WGS84()) | |
void | Reset (real lat0, real lon0, real h0=0) |
void | Reverse (real x, real y, real z, real &lat, real &lon, real &h) const |
void | Reverse (real x, real y, real z, real &lat, real &lon, real &h, std::vector< real > &M) const |
Inspector functions | |
Math::real | LatitudeOrigin () const |
Math::real | LongitudeOrigin () const |
Math::real | HeightOrigin () const |
Math::real | MajorRadius () const |
Math::real | Flattening () const |
Private Types | |
typedef Math::real | real |
Private Member Functions | |
void | IntForward (real lat, real lon, real h, real &x, real &y, real &z, real M[dim2_]) const |
void | IntReverse (real x, real y, real z, real &lat, real &lon, real &h, real M[dim2_]) const |
void | MatrixMultiply (real M[dim2_]) const |
Private Attributes | |
Geocentric | _earth |
real | _h0 |
real | _lat0 |
real | _lon0 |
real | _r [dim2_] |
real | _x0 |
real | _y0 |
real | _z0 |
Static Private Attributes | |
static const size_t | dim2_ = dim_ * dim_ |
static const size_t | dim_ = 3 |
Local cartesian coordinates.
Convert between geodetic coordinates latitude = lat, longitude = lon, height = h (measured vertically from the surface of the ellipsoid) to local cartesian coordinates (x, y, z). The origin of local cartesian coordinate system is at lat = lat0, lon = lon0, h = h0. The z axis is normal to the ellipsoid; the y axis points due north. The plane z = - h0 is tangent to the ellipsoid.
The conversions all take place via geocentric coordinates using a Geocentric object (by default Geocentric::WGS84()).
Example of use:
CartConvert is a command-line utility providing access to the functionality of Geocentric and LocalCartesian.
Definition at line 38 of file LocalCartesian.hpp.
|
private |
Definition at line 40 of file LocalCartesian.hpp.
|
inline |
Constructor setting the origin.
[in] | lat0 | latitude at origin (degrees). |
[in] | lon0 | longitude at origin (degrees). |
[in] | h0 | height above ellipsoid at origin (meters); default 0. |
[in] | earth | Geocentric object for the transformation; default Geocentric::WGS84(). |
lat0 should be in the range [−90°, 90°].
Definition at line 64 of file LocalCartesian.hpp.
|
inlineexplicit |
Default constructor.
[in] | earth | Geocentric object for the transformation; default Geocentric::WGS84(). |
Sets lat0 = 0, lon0 = 0, h0 = 0.
Definition at line 77 of file LocalCartesian.hpp.
|
inline |
Definition at line 229 of file LocalCartesian.hpp.
|
inline |
Convert from geodetic to local cartesian coordinates.
[in] | lat | latitude of point (degrees). |
[in] | lon | longitude of point (degrees). |
[in] | h | height of point above the ellipsoid (meters). |
[out] | x | local cartesian coordinate (meters). |
[out] | y | local cartesian coordinate (meters). |
[out] | z | local cartesian coordinate (meters). |
lat should be in the range [−90°, 90°].
Definition at line 104 of file LocalCartesian.hpp.
|
inline |
Convert from geodetic to local cartesian 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 | local cartesian coordinate (meters). |
[out] | y | local cartesian coordinate (meters). |
[out] | z | local cartesian coordinate (meters). |
[out] | M | if the length of the vector is 9, fill with the rotation matrix in row-major order. |
lat should be in the range [−90°, 90°].
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 135 of file LocalCartesian.hpp.
|
inline |
Definition at line 216 of file LocalCartesian.hpp.
|
private |
Definition at line 37 of file src/LocalCartesian.cpp.
|
private |
Definition at line 50 of file src/LocalCartesian.cpp.
|
inline |
Definition at line 206 of file LocalCartesian.hpp.
|
inline |
Definition at line 211 of file LocalCartesian.hpp.
|
inline |
Definition at line 223 of file LocalCartesian.hpp.
|
private |
Definition at line 27 of file src/LocalCartesian.cpp.
Reset the origin.
[in] | lat0 | latitude at origin (degrees). |
[in] | lon0 | longitude at origin (degrees). |
[in] | h0 | height above ellipsoid at origin (meters); default 0. |
lat0 should be in the range [−90°, 90°].
Definition at line 16 of file src/LocalCartesian.cpp.
|
inline |
Convert from local cartesian to geodetic coordinates.
[in] | x | local cartesian coordinate (meters). |
[in] | y | local cartesian coordinate (meters). |
[in] | z | local cartesian coordinate (meters). |
[out] | lat | latitude of point (degrees). |
[out] | lon | longitude of point (degrees). |
[out] | h | height of point above the ellipsoid (meters). |
The value of lon returned is in the range [−180°, 180°].
Definition at line 159 of file LocalCartesian.hpp.
|
inline |
Convert from local cartesian to geodetic coordinates and return rotation matrix.
[in] | x | local cartesian coordinate (meters). |
[in] | y | local cartesian coordinate (meters). |
[in] | z | local cartesian 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 | if the length of the vector is 9, fill with the rotation matrix in row-major order. |
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 189 of file LocalCartesian.hpp.
|
private |
Definition at line 43 of file LocalCartesian.hpp.
|
private |
Definition at line 44 of file LocalCartesian.hpp.
|
private |
Definition at line 44 of file LocalCartesian.hpp.
|
private |
Definition at line 44 of file LocalCartesian.hpp.
Definition at line 45 of file LocalCartesian.hpp.
|
private |
Definition at line 45 of file LocalCartesian.hpp.
|
private |
Definition at line 45 of file LocalCartesian.hpp.
|
private |
Definition at line 45 of file LocalCartesian.hpp.
Definition at line 42 of file LocalCartesian.hpp.
|
staticprivate |
Definition at line 41 of file LocalCartesian.hpp.