Browse Source

AP_Math: move locations_are_same to Location and rename to same_latlon_as

mission-4.1.18
Pierre Kancir 6 years ago committed by Tom Pittenger
parent
commit
b10e75f4e1
  1. 8
      libraries/AP_Common/Location.cpp
  2. 3
      libraries/AP_Common/Location.h
  3. 6
      libraries/AP_Math/location.cpp
  4. 4
      libraries/AP_Math/location.h

8
libraries/AP_Common/Location.cpp

@ -308,3 +308,11 @@ int32_t Location::get_bearing_to(const struct Location &loc2) const @@ -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);
}

3
libraries/AP_Common/Location.h

@ -94,6 +94,9 @@ public: @@ -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
*/

6
libraries/AP_Math/location.cpp

@ -88,12 +88,6 @@ Vector3f location_3d_diff_NED(const struct Location &loc1, const struct Location @@ -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)

4
libraries/AP_Math/location.h

@ -48,10 +48,6 @@ float location_path_proportion(const struct Location &location, @@ -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

Loading…
Cancel
Save