Skip to content

Commit c0e9251

Browse files
authored
fix(compare_map_segmentation): use squared distance to compare threshold (autowarefoundation#8744)
fix: use square distance to compare threshold Signed-off-by: yoshiri <yoshiyoshidetteiu@gmail.com>
1 parent 799e4f9 commit c0e9251

File tree

1 file changed

+3
-3
lines changed
  • perception/autoware_compare_map_segmentation/src/distance_based_compare_map_filter

1 file changed

+3
-3
lines changed

perception/autoware_compare_map_segmentation/src/distance_based_compare_map_filter/node.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,14 +59,14 @@ bool DistanceBasedStaticMapLoader::is_close_to_map(
5959
}
6060

6161
std::vector<int> nn_indices(1);
62-
std::vector<float> nn_distances(1);
62+
std::vector<float> nn_sqr_distances(1);
6363
if (!isFinite(point)) {
6464
return false;
6565
}
66-
if (!tree_->nearestKSearch(point, 1, nn_indices, nn_distances)) {
66+
if (!tree_->nearestKSearch(point, 1, nn_indices, nn_sqr_distances)) {
6767
return false;
6868
}
69-
if (nn_distances[0] > distance_threshold) {
69+
if (nn_sqr_distances[0] > distance_threshold * distance_threshold) {
7070
return false;
7171
}
7272
return true;

0 commit comments

Comments
 (0)