AP_Math: move location_3d_diff_NED to Location and rename

This commit is contained in:
Pierre Kancir 2019-04-08 15:27:31 +02:00 committed by Peter Barker
parent 7034ef2df7
commit 121e5d0abf
4 changed files with 11 additions and 16 deletions

View File

@ -231,6 +231,14 @@ Vector2f Location::get_distance_NE(const Location &loc2) const
(loc2.lng - lng) * LOCATION_SCALING_FACTOR * longitude_scale());
}
// return the distance in meters in North/East/Down plane as a N/E/D vector to loc2
Vector3f Location::get_distance_NED(const Location &loc2) const
{
return Vector3f((loc2.lat - lat) * LOCATION_SCALING_FACTOR,
(loc2.lng - lng) * LOCATION_SCALING_FACTOR * longitude_scale(),
(alt - loc2.alt) * 0.01f);
}
// extrapolate latitude/longitude given distances (in meters) north and east
void Location::offset(float ofs_north, float ofs_east)
{

View File

@ -72,6 +72,9 @@ public:
// return distance in meters between two locations
float get_distance(const struct Location &loc2) const;
// return the distance in meters in North/East/Down plane as a N/E/D vector to loc2
Vector3f get_distance_NED(const Location &loc2) const;
// return the distance in meters in North/East plane as a N/E vector to loc2
Vector2f get_distance_NE(const Location &loc2) const;

View File

@ -77,16 +77,6 @@ float location_path_proportion(const struct Location &location,
/*
return the distance in meters in North/East/Down plane as a N/E/D vector
from loc1 to loc2
*/
Vector3f location_3d_diff_NED(const struct Location &loc1, const struct Location &loc2)
{
return Vector3f((loc2.lat - loc1.lat) * LOCATION_SCALING_FACTOR,
(loc2.lng - loc1.lng) * LOCATION_SCALING_FACTOR * loc1.longitude_scale(),
(loc1.alt - loc2.alt) * 0.01f);
}
// return true when lat and lng are within range

View File

@ -42,12 +42,6 @@ float location_path_proportion(const struct Location &location,
const struct Location &point1,
const struct Location &point2);
/*
return the distance in meters in North/East/Down plane as a N/E/D vector
from loc1 to loc2
*/
Vector3f location_3d_diff_NED(const struct Location &loc1, const struct Location &loc2);
// Converts from WGS84 geodetic coordinates (lat, lon, height)
// into WGS84 Earth Centered, Earth Fixed (ECEF) coordinates