42#include <pcl/octree/octree_pointcloud.h>
51template <
typename Po
intT>
86 point_sum_ += new_point;
98 centroid_arg = point_sum_;
99 centroid_arg /=
static_cast<float>(point_counter_);
102 centroid_arg *= 0.0f;
130template <
typename PointT,
131 typename LeafContainerT = OctreePointCloudVoxelCentroidContainer<PointT>,
132 typename BranchContainerT = OctreeContainerEmpty>
136 using Ptr = shared_ptr<OctreePointCloudVoxelCentroid<PointT, LeafContainerT>>;
138 shared_ptr<const OctreePointCloudVoxelCentroid<PointT, LeafContainerT>>;
148 :
OctreePointCloud<PointT, LeafContainerT, BranchContainerT>(resolution_arg)
163 assert(pointIdx_arg < this->
input_->size());
165 const PointT& point = (*this->
input_)[pointIdx_arg];
174 LeafContainerT* container = this->
createLeaf(key);
175 container->addPoint(point);
194 PointT& voxel_centroid_arg)
const
198 voxel_centroid_arg));
230#include <pcl/octree/impl/octree_pointcloud_voxelcentroid.hpp>
LeafContainerT * createLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg)
Create new leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
Octree container class that can serve as a base to construct own leaf node container classes.
std::vector< PointT, Eigen::aligned_allocator< PointT > > AlignedPointTVector
PointCloudConstPtr input_
Pointer to input point cloud dataset.
void genOctreeKeyforPoint(const PointT &point_arg, OctreeKey &key_arg) const
Generate octree key for voxel at a given point.
OctreePointCloud(const double resolution_arg)
Octree pointcloud constructor.
void adoptBoundingBoxToPoint(const PointT &point_idx_arg)
Grow the bounding box/octree until point fits.
typename OctreeBase< LeafContainerT, BranchContainerT >::LeafNode LeafNode
typename OctreeBase< LeafContainerT, BranchContainerT >::BranchNode BranchNode
virtual OctreePointCloudVoxelCentroidContainer * deepCopy() const
deep copy function
OctreePointCloudVoxelCentroidContainer()
Class initialization.
void addPoint(const PointT &new_point)
Add new point to voxel.
void getCentroid(PointT ¢roid_arg) const
Calculate centroid of voxel.
~OctreePointCloudVoxelCentroidContainer() override=default
Empty class deconstructor.
bool operator==(const OctreeContainerBase &) const override
Equal comparison operator - set to false.
void reset() override
Reset leaf container.
bool getVoxelCentroidAtPoint(const PointT &point_arg, PointT &voxel_centroid_arg) const
Get centroid for a single voxel addressed by a PointT point.
OctreePointCloudVoxelCentroid(const double resolution_arg)
OctreePointCloudVoxelCentroids class constructor.
shared_ptr< const OctreePointCloudVoxelCentroid< PointT, LeafContainerT > > ConstPtr
void getVoxelCentroidsRecursive(const BranchNode *branch_arg, OctreeKey &key_arg, typename OctreePointCloud< PointT, LeafContainerT, BranchContainerT >::AlignedPointTVector &voxel_centroid_list_arg) const
Recursively explore the octree and output a PointT vector of centroids for all occupied voxels.
typename OctreeT::LeafNode LeafNode
typename OctreeT::BranchNode BranchNode
uindex_t getVoxelCentroids(typename OctreePointCloud< PointT, LeafContainerT, BranchContainerT >::AlignedPointTVector &voxel_centroid_list_arg) const
Get PointT vector of centroids for all occupied voxels.
void addPointIdx(const uindex_t pointIdx_arg) override
Add DataT object to leaf node at octree key.
bool getVoxelCentroidAtPoint(const index_t &point_idx_arg, PointT &voxel_centroid_arg) const
Get centroid for a single voxel addressed by a PointT point from input cloud.
OctreePointCloud< PointT, LeafContainerT, BranchContainerT > OctreeT
~OctreePointCloudVoxelCentroid() override=default
Empty class deconstructor.
shared_ptr< OctreePointCloudVoxelCentroid< PointT, LeafContainerT > > Ptr
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.