AP_Math: move location_update to Location and rename to offset_bearing

This commit is contained in:
Pierre Kancir 2019-04-05 08:11:26 +02:00 committed by Peter Barker
parent 58328da5f3
commit b31e5bf055
2 changed files with 1 additions and 16 deletions

View File

@ -73,19 +73,7 @@ float location_path_proportion(const struct Location &location,
return (vec1 * vec2) / dsquared;
}
/*
* extrapolate latitude/longitude given bearing and distance
* Note that this function is accurate to about 1mm at a distance of
* 100m. This function has the advantage that it works in relative
* positions, so it keeps the accuracy even when dealing with small
* distances and floating point numbers
*/
void location_update(struct Location &loc, float bearing, float distance)
{
float ofs_north = cosf(radians(bearing))*distance;
float ofs_east = sinf(radians(bearing))*distance;
loc.offset(ofs_north, ofs_east);
}
/*
return the distance in meters in North/East plane as a N/E vector

View File

@ -42,9 +42,6 @@ float location_path_proportion(const struct Location &location,
const struct Location &point1,
const struct Location &point2);
// extrapolate latitude/longitude given bearing and distance
void location_update(struct Location &loc, float bearing, float distance);
/*
return the distance in meters in North/East plane as a N/E vector
from loc1 to loc2