MCPcopy Create free account
hub / github.com/PRBonn/MapClosures / AddPoints

Method AddPoints

cpp/map_closures/VoxelMap.cpp:88–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88void VoxelMap::AddPoints(const Vector3dVector &points) {
89 std::for_each(points.cbegin(), points.cend(), [&](const Eigen::Vector3d &point) {
90 const Voxel voxel = ToVoxelCoordinates(point, voxel_size_);
91 const auto [it, inserted] = map_.try_emplace(voxel, VoxelBlock());
92 if (!inserted) {
93 const VoxelBlock &voxel_block = it->second;
94 if (voxel_block.size() == max_points_per_normal_computation ||
95 std::any_of(voxel_block.cbegin(), voxel_block.cend(),
96 [&](const Eigen::Vector3d &voxel_point) {
97 return (voxel_point - point).norm() < map_resolution_;
98 })) {
99 return;
100 }
101 }
102 it->second.emplace_back(point);
103 });
104}
105
106Vector3dVector VoxelMap::Pointcloud() const {
107 Vector3dVector points;

Callers 1

AlignToLocalGroundFunction · 0.80

Calls 6

ToVoxelCoordinatesFunction · 0.85
VoxelBlockClass · 0.85
cbeginMethod · 0.80
cendMethod · 0.80
sizeMethod · 0.80
emplace_backMethod · 0.80

Tested by

no test coverage detected