-
Notifications
You must be signed in to change notification settings - Fork 312
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Style changes in voxelization and preprocessing utilities (#364)
* Unify Voxel functionalities, now everything comes from VoxelHashMap * This looks like an even better unification * Modernize VoxelDownsample * VoxelUtils is born, now everthing is liteally in one place, and we have some side effect code reduction * Macos does not like my include * Local style include * With move * As of benchmark * For each for the win * Remove unnecessary include * Const correcteness * Refresh changes * Add style changes for a separate PR * Add missing headers * Remove more raw for loops * Move Voxeldownsample into VoxelUtils * Cmake needs to know * Miss cpp * Remove duplicate * cmake-format * Format * We never used noexcept anywhere, why adding it now? * We always use frame, if we want to move point_cloud, let's do it in a seprate PR * put back whitespaces * reduce diff --------- Co-authored-by: tizianoGuadagnino <[email protected]> Co-authored-by: Luca Lobefaro <[email protected]> Co-authored-by: Benedikt Mersch <[email protected]>
- Loading branch information
1 parent
a9f527d
commit 1c28d17
Showing
7 changed files
with
40 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#include "VoxelUtils.hpp" | ||
|
||
#include <tsl/robin_map.h> | ||
|
||
namespace kiss_icp { | ||
|
||
std::vector<Eigen::Vector3d> VoxelDownsample(const std::vector<Eigen::Vector3d> &frame, | ||
const double voxel_size) { | ||
tsl::robin_map<Voxel, Eigen::Vector3d> grid; | ||
grid.reserve(frame.size()); | ||
std::for_each(frame.cbegin(), frame.cend(), [&](const auto &point) { | ||
const auto voxel = PointToVoxel(point, voxel_size); | ||
if (!grid.contains(voxel)) grid.insert({voxel, point}); | ||
}); | ||
std::vector<Eigen::Vector3d> frame_dowsampled; | ||
frame_dowsampled.reserve(grid.size()); | ||
std::for_each(grid.cbegin(), grid.cend(), [&](const auto &voxel_and_point) { | ||
frame_dowsampled.emplace_back(voxel_and_point.second); | ||
}); | ||
return frame_dowsampled; | ||
} | ||
|
||
} // namespace kiss_icp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters