Point Cloud Library (PCL) 1.15.0
Loading...
Searching...
No Matches
pcl::recognition::ORROctree Class Reference

That's a very specialized and simple octree class. More...

#include <pcl/recognition/ransac_based/orr_octree.h>

Collaboration diagram for pcl::recognition::ORROctree:

Classes

class  Node

Public Types

using PointCloudIn = pcl::PointCloud<pcl::PointXYZ>
using PointCloudOut = pcl::PointCloud<pcl::PointXYZ>
using PointCloudN = pcl::PointCloud<pcl::Normal>

Public Member Functions

 ORROctree ()
virtual ~ORROctree ()
void clear ()
void build (const PointCloudIn &points, float voxel_size, const PointCloudN *normals=nullptr, float enlarge_bounds=0.00001f)
 Creates an octree which encloses 'points' and with leaf size equal to 'voxel_size'.
void build (const float *bounds, float voxel_size)
 Creates an empty octree with bounds at least as large as the ones provided as input and with leaf size equal to 'voxel_size'.
ORROctree::NodecreateLeaf (float x, float y, float z)
 Creates the leaf containing p = (x, y, z) and returns a pointer to it, however, only if p lies within the octree bounds!
void getFullLeavesIntersectedBySphere (const float *p, float radius, std::list< ORROctree::Node * > &out) const
 This method returns a super set of the full leavess which are intersected by the sphere with radius 'radius' and centered at 'p'.
ORROctree::NodegetRandomFullLeafOnSphere (const float *p, float radius) const
 Randomly chooses and returns a full leaf that is intersected by the sphere with center 'p' and 'radius'.
ORROctree::NodegetLeaf (int i, int j, int k)
 Since the leaves are aligned in a rectilinear grid, each leaf has a unique id.
ORROctree::NodegetLeaf (float x, float y, float z)
 Returns a pointer to the leaf containing p = (x, y, z) or NULL if no such leaf exists.
void deleteBranch (Node *node)
 Deletes the branch 'node' is part of.
std::vector< ORROctree::Node * > & getFullLeaves ()
 Returns a vector with all octree leaves which contain at least one point.
const std::vector< ORROctree::Node * > & getFullLeaves () const
void getFullLeavesPoints (PointCloudOut &out) const
void getNormalsOfFullLeaves (PointCloudN &out) const
ORROctree::NodegetRoot ()
const float * getBounds () const
void getBounds (float b[6]) const
float getVoxelSize () const
void insertNeighbors (Node *node)

Protected Attributes

float voxel_size_ {-1.0}
float bounds_ [6]
int tree_levels_ {-1}
Noderoot_ {nullptr}
std::vector< Node * > full_leaves_

Detailed Description

That's a very specialized and simple octree class.

That's the way it is intended to be, that's why no templates and stuff like this.

Author
Chavdar Papazov

Definition at line 68 of file orr_octree.h.

Member Typedef Documentation

◆ PointCloudIn

◆ PointCloudN

◆ PointCloudOut

Constructor & Destructor Documentation

◆ ORROctree()

pcl::recognition::ORROctree::ORROctree ( )

◆ ~ORROctree()

virtual pcl::recognition::ORROctree::~ORROctree ( )
inlinevirtual

Definition at line 269 of file orr_octree.h.

References clear().

Member Function Documentation

◆ build() [1/2]

void pcl::recognition::ORROctree::build ( const float * bounds,
float voxel_size )

Creates an empty octree with bounds at least as large as the ones provided as input and with leaf size equal to 'voxel_size'.

◆ build() [2/2]

void pcl::recognition::ORROctree::build ( const PointCloudIn & points,
float voxel_size,
const PointCloudN * normals = nullptr,
float enlarge_bounds = 0.00001f )

Creates an octree which encloses 'points' and with leaf size equal to 'voxel_size'.

'enlarge_bounds' makes sure that no points from the input will lie on the octree boundary by enlarging the bounds by that factor. For example, enlarge_bounds = 1 means that the bounds will be enlarged by 100%. The default value is fine.

◆ clear()

void pcl::recognition::ORROctree::clear ( )

Referenced by ~ORROctree().

◆ createLeaf()

ORROctree::Node * pcl::recognition::ORROctree::createLeaf ( float x,
float y,
float z )
inline

Creates the leaf containing p = (x, y, z) and returns a pointer to it, however, only if p lies within the octree bounds!

A more general version which allows p to be out of bounds is not implemented yet. The method returns NULL if p is not within the root bounds. If the leaf containing p already exists nothing happens and method just returns a pointer to the leaf.

Definition at line 291 of file orr_octree.h.

References bounds_, pcl::recognition::ORROctree::Node::createChildren(), full_leaves_, pcl::recognition::ORROctree::Node::getCenter(), pcl::recognition::ORROctree::Node::getChild(), pcl::recognition::ORROctree::Node::getData(), insertNeighbors(), root_, pcl::recognition::ORROctree::Node::setData(), tree_levels_, and voxel_size_.

◆ deleteBranch()

void pcl::recognition::ORROctree::deleteBranch ( Node * node)

Deletes the branch 'node' is part of.

◆ getBounds() [1/2]

const float * pcl::recognition::ORROctree::getBounds ( ) const
inline

Definition at line 418 of file orr_octree.h.

References bounds_.

◆ getBounds() [2/2]

void pcl::recognition::ORROctree::getBounds ( float b[6]) const
inline

Definition at line 424 of file orr_octree.h.

References bounds_.

◆ getFullLeaves() [1/2]

std::vector< ORROctree::Node * > & pcl::recognition::ORROctree::getFullLeaves ( )
inline

Returns a vector with all octree leaves which contain at least one point.

Definition at line 403 of file orr_octree.h.

References full_leaves_.

◆ getFullLeaves() [2/2]

const std::vector< ORROctree::Node * > & pcl::recognition::ORROctree::getFullLeaves ( ) const
inline

Definition at line 406 of file orr_octree.h.

References full_leaves_.

◆ getFullLeavesIntersectedBySphere()

void pcl::recognition::ORROctree::getFullLeavesIntersectedBySphere ( const float * p,
float radius,
std::list< ORROctree::Node * > & out ) const

This method returns a super set of the full leavess which are intersected by the sphere with radius 'radius' and centered at 'p'.

Pointers to the intersected full leaves are saved in 'out'. The method computes a super set in the sense that in general not all leaves saved in 'out' are really intersected by the sphere. The intersection test is based on the leaf radius (since its faster than checking all leaf corners and sides), so we report more leaves than we should, but still, this is a fair approximation.

◆ getFullLeavesPoints()

void pcl::recognition::ORROctree::getFullLeavesPoints ( PointCloudOut & out) const

◆ getLeaf() [1/2]

ORROctree::Node * pcl::recognition::ORROctree::getLeaf ( float x,
float y,
float z )
inline

Returns a pointer to the leaf containing p = (x, y, z) or NULL if no such leaf exists.

Definition at line 364 of file orr_octree.h.

References bounds_, pcl::recognition::ORROctree::Node::getCenter(), pcl::recognition::ORROctree::Node::getChild(), pcl::recognition::ORROctree::Node::hasChildren(), root_, and tree_levels_.

◆ getLeaf() [2/2]

ORROctree::Node * pcl::recognition::ORROctree::getLeaf ( int i,
int j,
int k )
inline

Since the leaves are aligned in a rectilinear grid, each leaf has a unique id.

The method returns the leaf with id [i, j, k] or NULL is no such leaf exists.

Definition at line 352 of file orr_octree.h.

References bounds_, getLeaf(), and voxel_size_.

Referenced by getLeaf(), and insertNeighbors().

◆ getNormalsOfFullLeaves()

void pcl::recognition::ORROctree::getNormalsOfFullLeaves ( PointCloudN & out) const

◆ getRandomFullLeafOnSphere()

ORROctree::Node * pcl::recognition::ORROctree::getRandomFullLeafOnSphere ( const float * p,
float radius ) const

Randomly chooses and returns a full leaf that is intersected by the sphere with center 'p' and 'radius'.

Returns NULL if no leaf is intersected by that sphere.

◆ getRoot()

ORROctree::Node * pcl::recognition::ORROctree::getRoot ( )
inline

Definition at line 415 of file orr_octree.h.

References root_.

◆ getVoxelSize()

float pcl::recognition::ORROctree::getVoxelSize ( ) const
inline

Definition at line 430 of file orr_octree.h.

References voxel_size_.

◆ insertNeighbors()

void pcl::recognition::ORROctree::insertNeighbors ( Node * node)
inline

Member Data Documentation

◆ bounds_

float pcl::recognition::ORROctree::bounds_[6]
protected

Definition at line 471 of file orr_octree.h.

Referenced by createLeaf(), getBounds(), getBounds(), getLeaf(), and getLeaf().

◆ full_leaves_

std::vector<Node*> pcl::recognition::ORROctree::full_leaves_
protected

Definition at line 474 of file orr_octree.h.

Referenced by createLeaf(), getFullLeaves(), and getFullLeaves().

◆ root_

Node* pcl::recognition::ORROctree::root_ {nullptr}
protected

Definition at line 473 of file orr_octree.h.

Referenced by createLeaf(), getLeaf(), and getRoot().

◆ tree_levels_

int pcl::recognition::ORROctree::tree_levels_ {-1}
protected

Definition at line 472 of file orr_octree.h.

Referenced by createLeaf(), and getLeaf().

◆ voxel_size_

float pcl::recognition::ORROctree::voxel_size_ {-1.0}
protected

Definition at line 471 of file orr_octree.h.

Referenced by createLeaf(), getLeaf(), getVoxelSize(), and insertNeighbors().


The documentation for this class was generated from the following file: