diff --git a/dlib/geometry/line.h b/dlib/geometry/line.h index 87c8b32fa..c540e1f37 100644 --- a/dlib/geometry/line.h +++ b/dlib/geometry/line.h @@ -134,7 +134,8 @@ namespace dlib line l, const dpoint& reference_point, const std::vector>& pts, - const double& dist_thresh + const double& dist_thresh_min = 0, + const double& dist_thresh_max = std::numeric_limits::infinity() ) { if (signed_distance_to_line(l,reference_point) < 0) @@ -144,7 +145,7 @@ namespace dlib for (auto& p : pts) { double dist = signed_distance_to_line(l,p); - if (0 <= dist && dist <= dist_thresh) + if (dist_thresh_min <= dist && dist <= dist_thresh_max) ++cnt; } return cnt; diff --git a/dlib/geometry/line_abstract.h b/dlib/geometry/line_abstract.h index 6aede1bde..44d46ad69 100644 --- a/dlib/geometry/line_abstract.h +++ b/dlib/geometry/line_abstract.h @@ -176,12 +176,18 @@ namespace dlib const line& l, const dpoint& reference_point, const std::vector>& pts, - const double& dist_thresh + const double& dist_thresh_min = 0, + const double& dist_thresh_max = std::numeric_limits::infinity() ); /*! ensures - - Returns a count of how many points in pts are on the same side of l as - reference_point, but also no more than dist_thresh distance from the line. + - Returns a count of how many points in pts have a distance from the line l + that is in the range [dist_thresh_min, dist_thresh_max]. This distance is a + signed value that indicates how far a point is from the line. Moreover, if + the point is on the same side as reference_point then the distance is + positive, otherwise it is negative. So for example, If this range is [0, + infinity] then this function counts how many points are on the same side of l + as reference_point. !*/ // ----------------------------------------------------------------------------------------