From b10e75f4e1e16f5172342e9e2a2080b07daf5671 Mon Sep 17 00:00:00 2001 From: Pierre Kancir Date: Mon, 8 Apr 2019 13:45:08 +0200 Subject: [PATCH] AP_Math: move locations_are_same to Location and rename to same_latlon_as --- libraries/AP_Common/Location.cpp | 8 ++++++++ libraries/AP_Common/Location.h | 3 +++ libraries/AP_Math/location.cpp | 6 ------ libraries/AP_Math/location.h | 4 ---- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/libraries/AP_Common/Location.cpp b/libraries/AP_Common/Location.cpp index 51ff24536d..aa2461fec3 100644 --- a/libraries/AP_Common/Location.cpp +++ b/libraries/AP_Common/Location.cpp @@ -308,3 +308,11 @@ int32_t Location::get_bearing_to(const struct Location &loc2) const } return bearing; } + +/* + return true if lat and lng match. Ignores altitude and options + */ +bool Location::same_latlon_as(const Location &loc2) const +{ + return (lat == loc2.lat) && (lng == loc2.lng); +} diff --git a/libraries/AP_Common/Location.h b/libraries/AP_Common/Location.h index b299e5108a..ea10e1aac7 100644 --- a/libraries/AP_Common/Location.h +++ b/libraries/AP_Common/Location.h @@ -94,6 +94,9 @@ public: // return bearing in centi-degrees from location to loc2 int32_t get_bearing_to(const struct Location &loc2) const; + // check if lat and lng match. Ignore altitude and options + bool same_latlon_as(const Location &loc2) const; + /* * convert invalid waypoint with useful data. return true if location changed */ diff --git a/libraries/AP_Math/location.cpp b/libraries/AP_Math/location.cpp index 0a4d588865..993a235f49 100644 --- a/libraries/AP_Math/location.cpp +++ b/libraries/AP_Math/location.cpp @@ -88,12 +88,6 @@ Vector3f location_3d_diff_NED(const struct Location &loc1, const struct Location (loc1.alt - loc2.alt) * 0.01f); } -/* - return true if lat and lng match. Ignores altitude and options - */ -bool locations_are_same(const struct Location &loc1, const struct Location &loc2) { - return (loc1.lat == loc2.lat) && (loc1.lng == loc2.lng); -} // return true when lat and lng are within range bool check_lat(float lat) diff --git a/libraries/AP_Math/location.h b/libraries/AP_Math/location.h index be4b9ce425..4dd6859d57 100644 --- a/libraries/AP_Math/location.h +++ b/libraries/AP_Math/location.h @@ -48,10 +48,6 @@ float location_path_proportion(const struct Location &location, */ Vector3f location_3d_diff_NED(const struct Location &loc1, const struct Location &loc2); -/* - * check if lat and lng match. Ignore altitude and options - */ -bool locations_are_same(const struct Location &loc1, const struct Location &loc2); // Converts from WGS84 geodetic coordinates (lat, lon, height) // into WGS84 Earth Centered, Earth Fixed (ECEF) coordinates