From c0e92510052e5c18270e8087a4741ecad9887e8d Mon Sep 17 00:00:00 2001 From: Yoshi Ri Date: Wed, 4 Sep 2024 01:52:45 +0900 Subject: [PATCH] fix(compare_map_segmentation): use squared distance to compare threshold (#8744) fix: use square distance to compare threshold Signed-off-by: yoshiri --- .../src/distance_based_compare_map_filter/node.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/perception/autoware_compare_map_segmentation/src/distance_based_compare_map_filter/node.cpp b/perception/autoware_compare_map_segmentation/src/distance_based_compare_map_filter/node.cpp index 53183cd7dc3f0..e5ff8da4e4da9 100644 --- a/perception/autoware_compare_map_segmentation/src/distance_based_compare_map_filter/node.cpp +++ b/perception/autoware_compare_map_segmentation/src/distance_based_compare_map_filter/node.cpp @@ -59,14 +59,14 @@ bool DistanceBasedStaticMapLoader::is_close_to_map( } std::vector nn_indices(1); - std::vector nn_distances(1); + std::vector 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;