40#ifndef PCL_OCTREE_VOXELCENTROID_HPP
41#define PCL_OCTREE_VOXELCENTROID_HPP
50#include <pcl/octree/impl/octree_pointcloud.hpp>
53template <
typename Po
intT,
typename LeafContainerT,
typename BranchContainerT>
59 LeafContainerT* leaf = NULL;
66 leaf->getCentroid(voxel_centroid_arg);
68 return (leaf != NULL);
72template <
typename Po
intT,
typename LeafContainerT,
typename BranchContainerT>
82 voxel_centroid_list_arg.clear();
88 return (voxel_centroid_list_arg.size());
92template <
typename Po
intT,
typename LeafContainerT,
typename BranchContainerT>
102 for (
unsigned char child_idx = 0; child_idx < 8; child_idx++) {
104 if (branch_arg->hasChild(child_idx)) {
108 OctreeNode* child_node = branch_arg->getChildPtr(child_idx);
115 voxel_centroid_list_arg);
121 auto* container =
static_cast<LeafNode*
>(child_node);
123 container->getContainer().getCentroid(new_centroid);
125 voxel_centroid_list_arg.push_back(new_centroid);
138#define PCL_INSTANTIATE_OctreePointCloudVoxelCentroid(T) \
139 template class PCL_EXPORTS pcl::octree::OctreePointCloudVoxelCentroid<T>;
std::size_t leaf_count_
Amount of leaf nodes.
BranchNode * root_node_
Pointer to root branch node of octree.
LeafContainerT * findLeaf(uindex_t idx_x_arg, uindex_t idx_y_arg, uindex_t idx_z_arg) const
Find leaf node at (idx_x_arg, idx_y_arg, idx_z_arg).
void popBranch()
pop child node from octree key
void pushBranch(unsigned char childIndex)
push a child node to the octree key
Abstract octree node class
virtual node_type_t getNodeType() const =0
Pure virtual method for retrieving the type of octree node (branch or leaf).
std::vector< PointT, Eigen::aligned_allocator< PointT > > AlignedPointTVector
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.
bool getVoxelCentroidAtPoint(const PointT &point_arg, PointT &voxel_centroid_arg) const
Get centroid for a single voxel addressed by a PointT point.
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.
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.