mirror of https://github.com/ArduPilot/ardupilot
AP_Math: move location_diff to Location and rename
This commit is contained in:
parent
06ed4f032a
commit
00fa07ef33
|
@ -220,6 +220,17 @@ float Location::get_distance(const struct Location &loc2) const
|
||||||
return norm(dlat, dlng) * LOCATION_SCALING_FACTOR;
|
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
|
// extrapolate latitude/longitude given distances (in meters) north and east
|
||||||
void Location::offset(float ofs_north, float ofs_east)
|
void Location::offset(float ofs_north, float ofs_east)
|
||||||
{
|
{
|
||||||
|
|
|
@ -72,6 +72,9 @@ public:
|
||||||
// return distance in meters between two locations
|
// return distance in meters between two locations
|
||||||
float get_distance(const struct Location &loc2) const;
|
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
|
// extrapolate latitude/longitude given distances (in meters) north and east
|
||||||
void offset(float ofs_north, float ofs_east);
|
void offset(float ofs_north, float ofs_east);
|
||||||
|
|
||||||
|
|
|
@ -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
|
return the distance in meters in North/East/Down plane as a N/E/D vector
|
||||||
|
|
|
@ -42,12 +42,6 @@ float location_path_proportion(const struct Location &location,
|
||||||
const struct Location &point1,
|
const struct Location &point1,
|
||||||
const struct Location &point2);
|
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
|
return the distance in meters in North/East/Down plane as a N/E/D vector
|
||||||
from loc1 to loc2
|
from loc1 to loc2
|
||||||
|
|
Loading…
Reference in New Issue