|
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 (const Geocentric &earth=Geocentric::WGS84()) |
|
| LocalCartesian (real lat0, real lon0, real h0=0, 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 |
|
|
Math::real | LatitudeOrigin () const |
|
Math::real | LongitudeOrigin () const |
|
Math::real | HeightOrigin () const |
|
Math::real | MajorRadius () const |
|
Math::real | Flattening () const |
|
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:
#include <iostream>
#include <exception>
#include <cmath>
try {
const double lat0 = 48 + 50/60.0,
lon0 = 2 + 20/60.0;
{
double lat = 50.9,
lon = 1.8,
h = 0;
cout <<
x <<
" " <<
y <<
" " <<
z <<
"\n";
}
{
double x = -38e3,
y = 230e3,
z = -4e3;
cout <<
lat <<
" " <<
lon <<
" " <<
h <<
"\n";
}
}
catch (
const exception&
e) {
cerr <<
"Caught exception: " <<
e.what() <<
"\n";
return 1;
}
}
CartConvert is a command-line utility providing access to the functionality of Geocentric and LocalCartesian.
Definition at line 38 of file LocalCartesian.hpp.
Convert from geodetic to local cartesian coordinates and return rotation matrix.
- Parameters
-
[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
- in east, north, up coordinates (where the components are relative to a local coordinate system at (lat, lon, h)); call this representation v1.
- in x, y, z coordinates (where the components are relative to the local coordinate system at (lat0, lon0, h0)); call this representation v0.
Then we have v0 = M ⋅ v1.
Definition at line 135 of file LocalCartesian.hpp.
Convert from local cartesian to geodetic coordinates and return rotation matrix.
- Parameters
-
[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
- in east, north, up coordinates (where the components are relative to a local coordinate system at (lat, lon, h)); call this representation v1.
- in x, y, z coordinates (where the components are relative to the local coordinate system at (lat0, lon0, h0)); call this representation v0.
Then we have v1 = MT ⋅ v0, where MT is the transpose of M.
Definition at line 189 of file LocalCartesian.hpp.