Browse Source

AP_Math: move location_passed_point to Location and rename

mission-4.1.18
Pierre Kancir 6 years ago committed by Andrew Tridgell
parent
commit
e06d7dbbf7
  1. 11
      libraries/AP_Common/Location.cpp
  2. 7
      libraries/AP_Common/Location.h
  3. 18
      libraries/AP_Math/location.cpp
  4. 9
      libraries/AP_Math/location.h

11
libraries/AP_Common/Location.cpp

@ -328,3 +328,14 @@ bool Location::check_latlng() const @@ -328,3 +328,14 @@ bool Location::check_latlng() const
{
return check_lat(lat) && check_lng(lng);
}
// see if location is past a line perpendicular to
// the line between point1 and point2 and passing through point2.
// If point1 is our previous waypoint and point2 is our target waypoint
// then this function returns true if we have flown past
// the target waypoint
bool Location::past_interval_finish_line(const Location &point1, const Location &point2) const
{
return this->line_path_proportion(point1, point2) >= 1.0f;
}

7
libraries/AP_Common/Location.h

@ -98,6 +98,13 @@ public: @@ -98,6 +98,13 @@ public:
// return true when lat and lng are within range
bool check_latlng() const;
// see if location is past a line perpendicular to
// the line between point1 and point2 and passing through point2.
// If point1 is our previous waypoint and point2 is our target waypoint
// then this function returns true if we have flown past
// the target waypoint
bool past_interval_finish_line(const Location &point1, const Location &point2) const;
private:
static AP_Terrain *_terrain;
};

18
libraries/AP_Math/location.cpp

@ -39,19 +39,6 @@ float get_bearing_cd(const Vector3f &origin, const Vector3f &destination) @@ -39,19 +39,6 @@ float get_bearing_cd(const Vector3f &origin, const Vector3f &destination)
return bearing;
}
// see if location is past a line perpendicular to
// the line between point1 and point2. If point1 is
// our previous waypoint and point2 is our target waypoint
// then this function returns true if we have flown past
// the target waypoint
bool location_passed_point(const struct Location &location,
const struct Location &point1,
const struct Location &point2)
{
return location_path_proportion(location, point1, point2) >= 1.0f;
}
/*
return the proportion we are along the path from point1 to
point2, along a line parallel to point1<->point2.
@ -73,11 +60,6 @@ float location_path_proportion(const struct Location &location, @@ -73,11 +60,6 @@ float location_path_proportion(const struct Location &location,
}
// return true when lat and lng are within range
bool check_lat(float lat)
{

9
libraries/AP_Math/location.h

@ -22,15 +22,6 @@ float get_horizontal_distance_cm(const Vector3f &origin, const Vector3f & @@ -22,15 +22,6 @@ float get_horizontal_distance_cm(const Vector3f &origin, const Vector3f &
// return bearing in centi-degrees between two positions
float get_bearing_cd(const Vector3f &origin, const Vector3f &destination);
// see if location is past a line perpendicular to
// the line between point1 and point2. If point1 is
// our previous waypoint and point2 is our target waypoint
// then this function returns true if we have flown past
// the target waypoint
bool location_passed_point(const struct Location & location,
const struct Location & point1,
const struct Location & point2);
/*
return the proportion we are along the path from point1 to
point2. This will be less than >1 if we have passed point2

Loading…
Cancel
Save