AP_Math: move location_diff to Location and rename

This commit is contained in:
Pierre Kancir 2019-04-08 14:22:38 +02:00 committed by Tom Pittenger
parent 06ed4f032a
commit 00fa07ef33
4 changed files with 15 additions and 15 deletions

View File

@ -220,6 +220,17 @@ float Location::get_distance(const struct Location &loc2) const
return norm(dlat, dlng) * LOCATION_SCALING_FACTOR;
}
/*
return the distance in meters in North/East plane as a N/E vector
from loc1 to loc2
*/
Vector2f Location::get_distance_NE(const Location &loc2) const
{
return Vector2f((loc2.lat - lat) * LOCATION_SCALING_FACTOR,
(loc2.lng - lng) * LOCATION_SCALING_FACTOR * longitude_scale());
}
// 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 plane as a N/E vector to loc2
Vector2f get_distance_NE(const Location &loc2) const;
// extrapolate latitude/longitude given distances (in meters) north and east
void offset(float ofs_north, float ofs_east);

View File

@ -75,15 +75,7 @@ float location_path_proportion(const struct Location &location,
/*
return the distance in meters in North/East plane as a N/E vector
from loc1 to loc2
*/
Vector2f location_diff(const struct Location &loc1, const struct Location &loc2)
{
return Vector2f((loc2.lat - loc1.lat) * LOCATION_SCALING_FACTOR,
(loc2.lng - loc1.lng) * LOCATION_SCALING_FACTOR * loc1.longitude_scale());
}
/*
return the distance in meters in North/East/Down plane as a N/E/D vector

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 plane as a N/E vector
from loc1 to loc2
*/
Vector2f location_diff(const struct Location &loc1, const struct Location &loc2);
/*
return the distance in meters in North/East/Down plane as a N/E/D vector
from loc1 to loc2