Bug fix: `remove_outliers` was removing ALL points when no outliers were found

Bug in current code: when no outliers are found, `f2r` is `sorted_points.end()`. So, `if (sit == f2r)` is never true, and `out` keeps its initial value, which is `points.begin()`.
This commit is contained in:
Clément Jamin 2021-11-16 12:06:32 +01:00 committed by GitHub
parent b26fa9b5ba
commit 597970b368
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -266,7 +266,7 @@ remove_outliers(
// Replaces [points.begin(), points.end()) range by the sorted content. // Replaces [points.begin(), points.end()) range by the sorted content.
iterator pit = points.begin(); iterator pit = points.begin();
iterator out = points.begin(); iterator out = points.end();
for (auto sit = sorted_points.begin(); sit != sorted_points.end(); ++ sit) for (auto sit = sorted_points.begin(); sit != sorted_points.end(); ++ sit)
{ {