Skip to content

Commit

Permalink
fix(compare_map_segmentation): use squared distance to compare thresh…
Browse files Browse the repository at this point in the history
…old (#8744)

fix: use square distance to compare threshold

Signed-off-by: yoshiri <[email protected]>
  • Loading branch information
YoshiRi authored Sep 3, 2024
1 parent 799e4f9 commit c0e9251
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ bool DistanceBasedStaticMapLoader::is_close_to_map(
}

std::vector<int> nn_indices(1);
std::vector<float> nn_distances(1);
std::vector<float> nn_sqr_distances(1);
if (!isFinite(point)) {
return false;
}
if (!tree_->nearestKSearch(point, 1, nn_indices, nn_distances)) {
if (!tree_->nearestKSearch(point, 1, nn_indices, nn_sqr_distances)) {
return false;
}
if (nn_distances[0] > distance_threshold) {
if (nn_sqr_distances[0] > distance_threshold * distance_threshold) {
return false;
}
return true;
Expand Down

0 comments on commit c0e9251

Please sign in to comment.