ReUseX  0.0.5
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
downsample.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6
7#include "reusex/types.hpp"
8
9#include <cstdint>
10#include <vector>
11
12namespace reusex::geometry {
13
27 float leaf_size = 0.0f;
28
30 uint32_t bucket_count = 0;
31
34 double origin_x = 0.0;
35 double origin_y = 0.0;
36 double origin_z = 0.0;
37
40 std::vector<uint32_t> point_to_bucket;
41
43 static constexpr uint32_t kSkippedPoint =
44 static_cast<uint32_t>(-1);
45};
46
59VoxelAssignment voxel_assignment(const Cloud &cloud, float leaf_size);
60
66CloudPtr downsample(const Cloud &cloud, const VoxelAssignment &a);
67
74
75} // namespace reusex::geometry
CloudPtr downsample(const Cloud &cloud, const VoxelAssignment &a)
Downsample cloud using the precomputed assignment.
VoxelAssignment voxel_assignment(const Cloud &cloud, float leaf_size)
Build a voxel assignment for cloud at the given leaf size.
typename CloudN::Ptr CloudNPtr
Definition types.hpp:31
pcl::PointCloud< PointT > Cloud
Definition types.hpp:26
typename Cloud::Ptr CloudPtr
Definition types.hpp:27
pcl::PointCloud< NormalT > CloudN
Definition types.hpp:30
Per-input-point assignment to an output voxel bucket.
std::vector< uint32_t > point_to_bucket
For each input point: the bucket id it falls into, or kSkippedPoint if the point was non-finite (and ...
double origin_x
Minimum corner of the input cloud's bounding box (over finite points).
uint32_t bucket_count
Number of unique occupied voxels (== output cloud size).
static constexpr uint32_t kSkippedPoint
Sentinel marking input points that were skipped during assignment.
float leaf_size
Voxel edge length used to bucket points.