mirror of
https://github.com/davisking/dlib.git
synced 2024-11-01 10:14:53 +08:00
Made count_points_on_side_of_line() take a lower threshold in addition to the
upper threshold. This changes the function's API.
This commit is contained in:
parent
5f9c881f7b
commit
0c652dd46a
@ -134,7 +134,8 @@ namespace dlib
|
||||
line l,
|
||||
const dpoint& reference_point,
|
||||
const std::vector<vector<T,2>>& pts,
|
||||
const double& dist_thresh
|
||||
const double& dist_thresh_min = 0,
|
||||
const double& dist_thresh_max = std::numeric_limits<double>::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;
|
||||
|
@ -176,12 +176,18 @@ namespace dlib
|
||||
const line& l,
|
||||
const dpoint& reference_point,
|
||||
const std::vector<vector<T,2>>& pts,
|
||||
const double& dist_thresh
|
||||
const double& dist_thresh_min = 0,
|
||||
const double& dist_thresh_max = std::numeric_limits<double>::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.
|
||||
!*/
|
||||
|
||||
// ----------------------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user