mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
AP_Math: move location_update to Location and rename to offset_bearing
This commit is contained in:
parent
58328da5f3
commit
b31e5bf055
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user