Modules | |
WGS84 Parameters | |
Functions | |
static void | ecef2ned_matrix (const double ref_ecef[3], double M[3][3]) |
void | wgsecef2azel (const double ecef[3], const double ref_ecef[3], double *azimuth, double *elevation) |
void | wgsecef2llh (const double const ecef[3], double llh[3]) |
void | wgsecef2ned (const double ecef[3], const double ref_ecef[3], double ned[3]) |
void | wgsecef2ned_d (const double ecef[3], const double ref_ecef[3], double ned[3]) |
void | wgsllh2ecef (const double const llh[3], double ecef[3]) |
void | wgsned2ecef (const double ned[3], const double ref_ecef[3], double ecef[3]) |
void | wgsned2ecef_d (const double ned[3], const double ref_ecef[3], double ecef[3]) |
Functions used for converting between various coordinate systems. References:
static void ecef2ned_matrix | ( | const double | ref_ecef[3], |
double | M[3][3] | ||
) | [static] |
Helper function which populates a provided 3x3 matrix with the appropriate rotation matrix to transform from ECEF to NED coordinates, given the provided ECEF reference vector.
ref_ecef | Cartesian coordinates of reference vector, passed as [X, Y, Z], all in meters. |
M | 3x3 matrix to be populated with rotation matrix. |
Definition at line 192 of file coord_system.c.
void wgsecef2azel | ( | const double | ecef[3], |
const double | ref_ecef[3], | ||
double * | azimuth, | ||
double * | elevation | ||
) |
Determine the azimuth and elevation of a point in WGS84 Earth Centered, Earth Fixed (ECEF) Cartesian coordinates from a reference point given in WGS84 ECEF coordinates.
First the vector between the points is converted into the local North, East, Down frame of the reference point. Then we can directly calculate the azimuth and elevation.
ecef | Cartesian coordinates of the point, passed as [X, Y, Z], all in meters. |
ref_ecef | Cartesian coordinates of the reference point from which the azimuth and elevation is to be determined, passed as [X, Y, Z], all in meters. |
azimuth | Pointer to where to store the calculated azimuth output. |
elevation | Pointer to where to store the calculated elevation output. |
Definition at line 325 of file coord_system.c.
void wgsecef2llh | ( | const double const | ecef[3], |
double | llh[3] | ||
) |
Converts from WGS84 Earth Centered, Earth Fixed (ECEF) Cartesian coordinates (X, Y and Z) into WGS84 geodetic coordinates (latitude, longitude and height).
Conversion from Cartesian to geodetic coordinates is a much harder problem than conversion from geodetic to Cartesian. There is no satisfactory closed form solution but many different iterative approaches exist.
Here we implement a relatively new algorithm due to Fukushima (2006) that is very computationally efficient, not requiring any transcendental function calls during iteration and very few divisions. It also exhibits cubic convergence rates compared to the quadratic rate of convergence seen with the more common algortihms based on the Newton-Raphson method.
References:
ecef | Cartesian coordinates to be converted, passed as [X, Y, Z], all in meters. |
llh | Converted geodetic coordinates are written into this array as [lat, lon, height] in [radians, radians, meters]. |
Definition at line 92 of file coord_system.c.
void wgsecef2ned | ( | const double | ecef[3], |
const double | ref_ecef[3], | ||
double | ned[3] | ||
) |
Converts a vector in WGS84 Earth Centered, Earth Fixed (ECEF) Cartesian coordinates to the local North, East, Down (NED) frame of a reference point, also given in WGS84 ECEF coordinates.
Note, this function only rotates the ECEF vector into the NED frame of the reference point, as would be appropriate for e.g. a velocity vector. To determine the distance between the point and the reference point in the NED frame of the reference point, see wgsecef2ned_d.
ecef | Cartesian coordinates of the point, passed as [X, Y, Z], all in meters. |
ref_ecef | Cartesian coordinates of the reference point, passed as [X, Y, Z], all in meters. |
ned | The North, East, Down vector is written into this array as [N, E, D], all in meters. |
Definition at line 234 of file coord_system.c.
void wgsecef2ned_d | ( | const double | ecef[3], |
const double | ref_ecef[3], | ||
double | ned[3] | ||
) |
Returns the vector to a point given in WGS84 Earth Centered, Earth Fixed (ECEF) Cartesian coordinates from a reference point, also given in WGS84 ECEF coordinates, in the local North, East, Down (NED) frame of the reference point.
ecef | Cartesian coordinates of the point, passed as [X, Y, Z], all in meters. |
ref_ecef | Cartesian coordinates of the reference point, passed as [X, Y, Z], all in meters. |
ned | The North, East, Down vector is written into this array as [N, E, D], all in meters. |
Definition at line 256 of file coord_system.c.
void wgsllh2ecef | ( | const double const | llh[3], |
double | ecef[3] | ||
) |
Converts from WGS84 geodetic coordinates (latitude, longitude and height) into WGS84 Earth Centered, Earth Fixed Cartesian (ECEF) coordinates (X, Y and Z).
Conversion from geodetic coordinates latitude, longitude and height into Cartesian coordinates can be achieved with the following formulae:
Where the 'radius of curvature', , is defined as:
and is the WGS84 semi-major axis and is the WGS84 eccentricity. See WGS84 Parameters.
llh | Geodetic coordinates to be converted, passed as [lat, lon, height] in [radians, radians, meters]. |
ecef | Converted Cartesian coordinates are written into this array as [X, Y, Z], all in meters. |
Definition at line 57 of file coord_system.c.
void wgsned2ecef | ( | const double | ned[3], |
const double | ref_ecef[3], | ||
double | ecef[3] | ||
) |
Converts a vector in WGS84 Earth Centered, Earth Fixed (ECEF) Cartesian coordinates to the local North, East, Down (NED) frame of a reference point, also given in WGS84 ECEF coordinates.
Note, this function only rotates the NED vector into the ECEF frame, as would be appropriate for e.g. a velocity vector. To pass an NED position in the reference frame of the NED, see wgsned2ecef_d.
ned | The North, East, Down vector is passed as [N, E, D], all in meters. |
ref_ecef | Cartesian coordinates of the reference point, passed as [X, Y, Z], all in meters. |
ecef | Cartesian coordinates of the point written into this array, [X, Y, Z], all in meters. |
Definition at line 281 of file coord_system.c.
void wgsned2ecef_d | ( | const double | ned[3], |
const double | ref_ecef[3], | ||
double | ecef[3] | ||
) |
For a point given in the local North, East, Down (NED) frame of a provided ECEF reference point, return the vector to that point in ECEF coordinates.
ned | The North, East, Down vector is passed as [N, E, D], all in meters. |
ref_ecef | Cartesian coordinates of the reference point, passed as [X, Y, Z], all in meters. |
ecef | Cartesian coordinates of the point written into this array, [X, Y, Z], all in meters. |
Definition at line 301 of file coord_system.c.