From 249e7f7f83d8cc8a17f544ae3fb6c702a864cac7 Mon Sep 17 00:00:00 2001 From: Ignacio Vizzo Date: Tue, 2 Apr 2024 18:26:01 +0200 Subject: [PATCH] Remove max_distance_2_ Leave it for other PR --- cpp/kiss_icp/core/VoxelHashMap.cpp | 3 ++- cpp/kiss_icp/core/VoxelHashMap.hpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cpp/kiss_icp/core/VoxelHashMap.cpp b/cpp/kiss_icp/core/VoxelHashMap.cpp index 304c67a7..9b5cbcd5 100644 --- a/cpp/kiss_icp/core/VoxelHashMap.cpp +++ b/cpp/kiss_icp/core/VoxelHashMap.cpp @@ -88,7 +88,8 @@ void VoxelHashMap::RemovePointsFarFromLocation(const Eigen::Vector3d &origin) { for (auto it = map_.begin(); it != map_.end();) { const auto &[voxel, voxel_block] = *it; const auto &pt = voxel_block.points.front(); - if ((pt - origin).squaredNorm() > (max_distance2_)) { + const auto max_distance2 = max_distance_ * max_distance_; + if ((pt - origin).squaredNorm() > (max_distance2)) { it = map_.erase(it); } else { ++it; diff --git a/cpp/kiss_icp/core/VoxelHashMap.hpp b/cpp/kiss_icp/core/VoxelHashMap.hpp index b88ca00e..7eff4347 100644 --- a/cpp/kiss_icp/core/VoxelHashMap.hpp +++ b/cpp/kiss_icp/core/VoxelHashMap.hpp @@ -52,7 +52,7 @@ struct VoxelHashMap { explicit VoxelHashMap(double voxel_size, double max_distance, int max_points_per_voxel) : voxel_size_(voxel_size), - max_distance2_(max_distance * max_distance), + max_distance_(max_distance), max_points_per_voxel_(max_points_per_voxel) {} inline void Clear() { map_.clear(); } @@ -70,7 +70,7 @@ struct VoxelHashMap { std::vector GetPoints(const std::vector &query_voxels) const; double voxel_size_; - double max_distance2_; + double max_distance_; int max_points_per_voxel_; tsl::robin_map map_; };