41#include <pcl/octree/octree_base.h>
42#include <pcl/point_cloud.h>
67template <
typename PointT,
102 shared_ptr<OctreePointCloud<PointT, LeafContainerT, BranchContainerT, OctreeT>>;
109 std::vector<PointXYZ, Eigen::aligned_allocator<PointXYZ>>;
136 inline PointCloudConstPtr
168 PCL_ERROR(
"[pcl::octree::OctreePointCloud::setResolution] Octree needs to be "
169 "empty to change its resolution(leaf count should must be 0)!\n");
257 const double point_y_arg,
258 const double point_z_arg)
const;
288 const Eigen::Vector3f&
end,
290 float precision = 0.2);
324 const double min_y_arg,
325 const double min_z_arg,
326 const double max_x_arg,
327 const double max_y_arg,
328 const double max_z_arg);
339 const double max_y_arg,
340 const double max_z_arg);
365 double& max_z_arg)
const;
406 Eigen::Vector3f& min_pt,
407 Eigen::Vector3f& max_pt)
const
424 PCL_ERROR(
"[pcl::octree::OctreePointCloud::enableDynamicDepth] Leaf count should "
450 unsigned char child_idx,
498 return (!((point_idx_arg.x <
min_x_) || (point_idx_arg.y <
min_y_) ||
499 (point_idx_arg.z <
min_z_) || (point_idx_arg.x >=
max_x_) ||
500 (point_idx_arg.y >=
max_y_) || (point_idx_arg.z >=
max_z_)));
518 const double point_y_arg,
519 const double point_z_arg,
548 PointT& point_arg)
const;
560 Eigen::Vector3f& min_pt,
561 Eigen::Vector3f& max_pt)
const;
613#ifdef PCL_NO_PRECOMPILE
614#include <pcl/octree/impl/octree_pointcloud.hpp>
PointCloud represents the base class in PCL for storing collections of 3D points.
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
std::size_t leaf_count_
Amount of leaf nodes.
bool dynamic_depth_enabled_
Enable dynamic_depth.
OctreeBase< LeafContainerT, BranchContainerT > OctreeT
OctreeBranchNode< BranchContainerT > BranchNode
uindex_t octree_depth_
Octree depth.
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).
OctreeBase()
Empty constructor.
OctreeLeafNode< LeafContainerT > LeafNode
Octree container class that does not store any information.
Octree container class that does store a vector of point indices.
Abstract octree iterator class
const OctreeKey & getCurrentOctreeKey() const
Get octree key for the current iterator octree node.
uindex_t getCurrentOctreeDepth() const
Get the current depth level of octree.
double getVoxelSquaredDiameter() const
Calculates the squared diameter of a voxel at leaf depth.
std::vector< PointT, Eigen::aligned_allocator< PointT > > AlignedPointTVector
bool isPointWithinBoundingBox(const PointT &point_idx_arg) const
Checks if given point is within the bounding box of the octree.
void getBoundingBox(double &min_x_arg, double &min_y_arg, double &min_z_arg, double &max_x_arg, double &max_y_arg, double &max_z_arg) const
Get bounding box for octree.
const PointT & getPointByIndex(uindex_t index_arg) const
Get point at index from input pointcloud dataset.
void addPointToCloud(const PointT &point_arg, PointCloudPtr cloud_arg)
Add point simultaneously to octree and input point cloud.
virtual bool genOctreeKeyForDataT(const index_t &data_arg, OctreeKey &key_arg) const
Virtual method for generating octree key for a given point index.
void deleteTree()
Delete the octree structure and its leaf nodes.
std::size_t max_objs_per_leaf_
void addPointsFromInputCloud()
Add points from input point cloud to octree.
PointCloudConstPtr input_
shared_ptr< const OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeBase< LeafContainerT > > > ConstPtr
void genLeafNodeCenterFromOctreeKey(const OctreeKey &key_arg, PointT &point_arg) const
Generate a point at center of leaf node voxel.
PointCloudConstPtr getInputCloud() const
Get a pointer to the input point cloud dataset.
void defineBoundingBox(const double cubeLen_arg)
Define bounding box cube for octree.
void genOctreeKeyforPoint(const PointT &point_arg, OctreeKey &key_arg) const
Generate octree key for voxel at a given point.
typename PointCloud::Ptr PointCloudPtr
void deleteVoxelAtPoint(const index_t &point_idx_arg)
Delete leaf node / voxel at given point from input cloud.
std::vector< PointXYZ, Eigen::aligned_allocator< PointXYZ > > AlignedPointXYZVector
LeafContainerT * findLeafAtPoint(const PointT &point_arg) const
Find octree leaf node at a given point.
shared_ptr< Indices > IndicesPtr
uindex_t getTreeDepth() const
Get the maximum depth of the octree.
typename PointCloud::ConstPtr PointCloudConstPtr
void genVoxelCenterFromOctreeKey(const OctreeKey &key_arg, uindex_t tree_depth_arg, PointT &point_arg) const
Generate a point at center of octree voxel at given tree level.
uindex_t getOccupiedVoxelCentersRecursive(const BranchNode *node_arg, const OctreeKey &key_arg, AlignedPointTVector &voxel_center_list_arg) const
Recursively search the tree for all leaf nodes and return a vector of voxel centers.
OctreePointCloud(const double resolution_arg)
Octree pointcloud constructor.
bool isVoxelOccupiedAtPoint(const index_t &point_idx_arg) const
Check if voxel at given point from input cloud exist.
double getVoxelSquaredSideLen(uindex_t tree_depth_arg) const
Calculates the squared voxel cube side length at given tree depth.
void adoptBoundingBoxToPoint(const PointT &point_idx_arg)
Grow the bounding box/octree until point fits.
void setEpsilon(double eps)
Set the search epsilon precision (error bound) for nearest neighbors searches.
bool bounding_box_defined_
double getEpsilon() const
Get the search epsilon precision (error bound) for nearest neighbors searches.
uindex_t getOccupiedVoxelCenters(AlignedPointTVector &voxel_center_list_arg) const
Get a PointT vector of centers of all occupied voxels.
double getVoxelSquaredDiameter(uindex_t tree_depth_arg) const
Calculates the squared diameter of a voxel at given tree depth.
shared_ptr< OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeBase< LeafContainerT > > > Ptr
void addPointFromCloud(uindex_t point_idx_arg, IndicesPtr indices_arg)
Add point at given index from input point cloud to octree.
void setInputCloud(const PointCloudConstPtr &cloud_arg, const IndicesConstPtr &indices_arg=IndicesConstPtr())
Provide a pointer to the input data set.
typename OctreeT::LeafNode LeafNode
double getVoxelSquaredSideLen() const
Calculates the squared voxel cube side length at leaf level.
void setResolution(double resolution_arg)
Set/change the octree voxel resolution.
void defineBoundingBox()
Investigate dimensions of pointcloud data set and define corresponding bounding box for octree.
double getResolution() const
Get octree voxel resolution.
void enableDynamicDepth(std::size_t maxObjsPerLeaf)
Enable dynamic octree structure.
void addPointToCloud(const PointT &point_arg, PointCloudPtr cloud_arg, IndicesPtr indices_arg)
Add point simultaneously to octree and input point cloud.
bool isVoxelOccupiedAtPoint(const PointT &point_arg) const
Check if voxel at given point exist.
void defineBoundingBox(const double min_x_arg, const double min_y_arg, const double min_z_arg, const double max_x_arg, const double max_y_arg, const double max_z_arg)
Define bounding box for octree.
OctreePointCloud< PointT, LeafContainerT, BranchContainerT, OctreeBase< LeafContainerT > > SingleBuffer
void deleteVoxelAtPoint(const PointT &point_arg)
Delete leaf node / voxel at given point.
pcl::PointCloud< PointT > PointCloud
typename OctreeT::BranchNode BranchNode
void getVoxelBounds(const OctreeIteratorBase< OctreeT > &iterator, Eigen::Vector3f &min_pt, Eigen::Vector3f &max_pt) const
Generate bounds of the current voxel of an octree iterator.
void genVoxelBoundsFromOctreeKey(const OctreeKey &key_arg, uindex_t tree_depth_arg, Eigen::Vector3f &min_pt, Eigen::Vector3f &max_pt) const
Generate bounds of an octree voxel using octree key and tree depth arguments.
IndicesConstPtr const getIndices() const
Get a pointer to the vector of indices used.
shared_ptr< const Indices > IndicesConstPtr
void expandLeafNode(LeafNode *leaf_node, BranchNode *parent_branch, unsigned char child_idx, uindex_t depth_mask)
Add point at index from input pointcloud dataset to octree.
uindex_t getApproxIntersectedVoxelCentersBySegment(const Eigen::Vector3f &origin, const Eigen::Vector3f &end, AlignedPointTVector &voxel_center_list, float precision=0.2)
Get a PointT vector of centers of voxels intersected by a line segment.
void defineBoundingBox(const double max_x_arg, const double max_y_arg, const double max_z_arg)
Define bounding box for octree.
void genOctreeKeyforPoint(const double point_x_arg, const double point_y_arg, const double point_z_arg, OctreeKey &key_arg) const
Generate octree key for voxel at a given point.
void getKeyBitSize()
Define octree key setting and octree depth based on defined bounding box.
virtual void addPointIdx(uindex_t point_idx_arg)
Add point at index from input pointcloud dataset to octree.
bool isVoxelOccupiedAtPoint(const double point_x_arg, const double point_y_arg, const double point_z_arg) const
Check if voxel at given point coordinates exist.
Defines all the PCL implemented PointT point type structures.
detail::int_type_t< detail::index_type_size, detail::index_type_signed > index_t
Type used for an index in PCL.
shared_ptr< const Indices > IndicesConstPtr
detail::int_type_t< detail::index_type_size, false > uindex_t
Type used for an unsigned index in PCL.