Point Cloud Library (PCL)
1.10.0
|
41 #include <pcl/point_cloud.h>
43 #include <pcl/octree/octree_pointcloud.h>
55 template<
typename Po
intT,
typename LeafContainerT = OctreeContainerPo
intIndices ,
typename BranchContainerT = OctreeContainerEmpty >
100 voxelSearch (
const int index, std::vector<int>& point_idx_data);
113 std::vector<float> &k_sqr_distances)
115 return (
nearestKSearch (cloud[index], k, k_indices, k_sqr_distances));
127 std::vector<float> &k_sqr_distances);
139 nearestKSearch (
int index,
int k, std::vector<int> &k_indices, std::vector<float> &k_sqr_distances);
183 std::vector<float> &k_sqr_distances,
unsigned int max_nn = 0)
185 return (
radiusSearch (cloud.
points[index], radius, k_indices, k_sqr_distances, max_nn));
198 std::vector<float> &k_sqr_distances,
unsigned int max_nn = 0)
const;
210 radiusSearch (
int index,
const double radius, std::vector<int> &k_indices,
211 std::vector<float> &k_sqr_distances,
unsigned int max_nn = 0)
const;
233 std::vector<int> &k_indices,
234 int max_voxel_count = 0)
const;
245 boxSearch (
const Eigen::Vector3f &min_pt,
const Eigen::Vector3f &max_pt, std::vector<int> &k_indices)
const;
358 unsigned int tree_depth, std::vector<int>& k_indices,
359 std::vector<float>& k_sqr_distances,
unsigned int max_nn)
const;
373 const OctreeKey& key,
unsigned int tree_depth,
374 const double squared_search_radius,
375 std::vector<prioPointQueueEntry>& point_candidates)
const;
387 unsigned int tree_depth,
int& result_index,
float& sqr_distance);
407 double max_z,
unsigned char a,
const OctreeNode* node,
409 int max_voxel_count)
const;
422 const OctreeKey& key,
unsigned int tree_depth, std::vector<int>& k_indices)
const;
442 double max_x,
double max_y,
double max_z,
444 std::vector<int> &k_indices,
445 int max_voxel_count)
const;
460 double &min_x,
double &min_y,
double &min_z,
461 double &max_x,
double &max_y,
double &max_z,
462 unsigned char &a)
const
465 const float epsilon = 1e-10f;
466 if (direction.x () == 0.0)
467 direction.x () = epsilon;
468 if (direction.y () == 0.0)
469 direction.y () = epsilon;
470 if (direction.z () == 0.0)
471 direction.z () = epsilon;
477 if (direction.x () < 0.0)
479 origin.x () =
static_cast<float> (this->
min_x_) +
static_cast<float> (this->
max_x_) - origin.x ();
480 direction.x () = -direction.x ();
483 if (direction.y () < 0.0)
485 origin.y () =
static_cast<float> (this->
min_y_) +
static_cast<float> (this->
max_y_) - origin.y ();
486 direction.y () = -direction.y ();
489 if (direction.z () < 0.0)
491 origin.z () =
static_cast<float> (this->
min_z_) +
static_cast<float> (this->
max_z_) - origin.z ();
492 direction.z () = -direction.z ();
495 min_x = (this->
min_x_ - origin.x ()) / direction.x ();
496 max_x = (this->
max_x_ - origin.x ()) / direction.x ();
497 min_y = (this->
min_y_ - origin.y ()) / direction.y ();
498 max_y = (this->
max_y_ - origin.y ()) / direction.y ();
499 min_z = (this->
min_z_ - origin.z ()) / direction.z ();
500 max_z = (this->
max_z_ - origin.z ()) / direction.z ();
589 #ifdef PCL_NO_PRECOMPILE
590 #include <pcl/octree/impl/octree_search.hpp>
This file defines compatibility wrappers for low level I/O functions.
prioPointQueueEntry()
Empty constructor
int getIntersectedVoxelIndicesRecursive(double min_x, double min_y, double min_z, double max_x, double max_y, double max_z, unsigned char a, const OctreeNode *node, const OctreeKey &key, std::vector< int > &k_indices, int max_voxel_count) const
Recursively search the tree for all intersected leaf nodes and return a vector of indices.
int getIntersectedVoxelIndices(Eigen::Vector3f origin, Eigen::Vector3f direction, std::vector< int > &k_indices, int max_voxel_count=0) const
Get indices of all voxels that are intersected by a ray (origin, direction).
std::vector< PointT, Eigen::aligned_allocator< PointT > > points
The point data.
std::vector< PointT, Eigen::aligned_allocator< PointT > > AlignedPointTVector
prioBranchQueueEntry(OctreeNode *_node, OctreeKey &_key, float _point_distance)
Constructor for initializing priority queue entry.
double getKNearestNeighborRecursive(const PointT &point, unsigned int K, const BranchNode *node, const OctreeKey &key, unsigned int tree_depth, const double squared_search_radius, std::vector< prioPointQueueEntry > &point_candidates) const
Recursive search method that explores the octree and finds the K nearest neighbors.
typename PointCloud::ConstPtr PointCloudConstPtr
const OctreeNode * node
Pointer to octree node.
bool operator<(const prioPointQueueEntry &rhs) const
Operator< for comparing priority queue entries with each other.
void boxSearchRecursive(const Eigen::Vector3f &min_pt, const Eigen::Vector3f &max_pt, const BranchNode *node, const OctreeKey &key, unsigned int tree_depth, std::vector< int > &k_indices) const
Recursive search method that explores the octree and finds points within a rectangular search area.
bool voxelSearch(const PointT &point, std::vector< int > &point_idx_data)
Search for neighbors within a voxel at given point.
int nearestKSearch(const PointCloud &cloud, int index, int k, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances)
Search for k-nearest neighbors at the query point.
void getNeighborsWithinRadiusRecursive(const PointT &point, const double radiusSquared, const BranchNode *node, const OctreeKey &key, unsigned int tree_depth, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn) const
Recursive search method that explores the octree and finds neighbors within a given radius.
int getIntersectedVoxelCenters(Eigen::Vector3f origin, Eigen::Vector3f direction, AlignedPointTVector &voxel_center_list, int max_voxel_count=0) const
Get a PointT vector of centers of all voxels that intersected by a ray (origin, direction).
PointCloud represents the base class in PCL for storing collections of 3D points.
int radiusSearch(const PointCloud &cloud, int index, double radius, std::vector< int > &k_indices, std::vector< float > &k_sqr_distances, unsigned int max_nn=0)
Search for all neighbors of query point that are within a given radius.
void approxNearestSearch(const PointCloud &cloud, int query_index, int &result_index, float &sqr_distance)
Search for approx.
A point structure representing Euclidean xyz coordinates, and the RGB color.
Abstract octree node class
Priority queue entry for point candidates
Abstract octree leaf class
int point_idx_
Index representing a point in the dataset given by setInputCloud.
float point_distance_
Distance to query point.
shared_ptr< const std::vector< int > > IndicesConstPtr
OctreePointCloudSearch(const double resolution)
Constructor.
Abstract octree branch class
float point_distance
Distance to query point.
int getNextIntersectedNode(double x, double y, double z, int a, int b, int c) const
Get the next visited node given the current node upper bounding box corner.
Priority queue entry for branch nodes
typename PointCloud::Ptr PointCloudPtr
typename OctreeT::BranchNode BranchNode
void approxNearestSearchRecursive(const PointT &point, const BranchNode *node, const OctreeKey &key, unsigned int tree_depth, int &result_index, float &sqr_distance)
Recursive search method that explores the octree and finds the approximate nearest neighbor.
void initIntersectedVoxel(Eigen::Vector3f &origin, Eigen::Vector3f &direction, double &min_x, double &min_y, double &min_z, double &max_x, double &max_y, double &max_z, unsigned char &a) const
Initialize raytracing algorithm.
shared_ptr< const OctreePointCloud< PointT, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, OctreeBase< pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty > > > ConstPtr
shared_ptr< OctreePointCloud< PointT, pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty, OctreeBase< pcl::octree::OctreeContainerPointIndices, pcl::octree::OctreeContainerEmpty > > > Ptr
shared_ptr< PointCloud< PointT > > Ptr
float pointSquaredDist(const PointT &point_a, const PointT &point_b) const
Helper function to calculate the squared distance between two points.
bool operator<(const prioBranchQueueEntry rhs) const
Operator< for comparing priority queue entries with each other.
prioPointQueueEntry(unsigned int &point_idx, float point_distance)
Constructor for initializing priority queue entry.
int getIntersectedVoxelCentersRecursive(double min_x, double min_y, double min_z, double max_x, double max_y, double max_z, unsigned char a, const OctreeNode *node, const OctreeKey &key, AlignedPointTVector &voxel_center_list, int max_voxel_count) const
Recursively search the tree for all intersected leaf nodes and return a vector of voxel centers.
shared_ptr< const PointCloud< PointT > > ConstPtr
shared_ptr< std::vector< int > > IndicesPtr
int getFirstIntersectedNode(double min_x, double min_y, double min_z, double mid_x, double mid_y, double mid_z) const
Find first child node ray will enter.
prioBranchQueueEntry()
Empty constructor
Octree pointcloud search class
std::vector< PointT, Eigen::aligned_allocator< PointT > > AlignedPointTVector
int boxSearch(const Eigen::Vector3f &min_pt, const Eigen::Vector3f &max_pt, std::vector< int > &k_indices) const
Search for points within rectangular search area Points exactly on the edges of the search rectangle ...
typename OctreeT::BranchNode BranchNode
typename OctreeT::LeafNode LeafNode
boost::shared_ptr< T > shared_ptr
Alias for boost::shared_ptr.