ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::TrueKdTree Class Reference

Proper KD-tree implementation. More...

#include <TrueKdTree.h>

Inheritance diagram for cloudViewer::TrueKdTree:
Collaboration diagram for cloudViewer::TrueKdTree:

Classes

class  BaseNode
 Tree base node. More...
 
class  Leaf
 Tree leaf. More...
 
class  Node
 Tree node. More...
 

Public Types

using LeafVector = std::vector< Leaf * >
 A vector of leaves. More...
 

Public Member Functions

 TrueKdTree (GenericIndexedCloudPersist *cloud)
 Default constructor. More...
 
 ~TrueKdTree ()
 Destructor. More...
 
GenericIndexedCloudPersistassociatedCloud () const
 Returns the associated cloud. More...
 
bool build (double maxError, DistanceComputationTools::ERROR_MEASURES errorMeasure=DistanceComputationTools::RMS, unsigned minPointCountPerCell=3, unsigned maxPointCountPerCell=0, GenericProgressCallback *progressCb=nullptr)
 Builds KD-tree. More...
 
void clear ()
 Clears structure. More...
 
double getMaxError () const
 Returns max error threshold used for planarity-based split strategy. More...
 
DistanceComputationTools::ERROR_MEASURES getMaxErrorType () const
 Returns max error estimator used for planarity-based split strategy. More...
 
bool getLeaves (LeafVector &leaves) const
 Returns all leaf nodes. More...
 

Static Public Attributes

static const uint8_t X_DIM = 0
 
static const uint8_t Y_DIM = 1
 
static const uint8_t Z_DIM = 2
 
static const uint8_t NODE_TYPE = 0
 
static const uint8_t LEAF_TYPE = 1
 

Protected Member Functions

BaseNodesplit (ReferenceCloud *subset)
 Recursive split process. More...
 

Protected Attributes

BaseNodem_root
 Root node. More...
 
GenericIndexedCloudPersistm_associatedCloud
 Associated cloud. More...
 
double m_maxError
 Max error for planarity-based split strategy (see m_errorMeasure) More...
 
DistanceComputationTools::ERROR_MEASURES m_errorMeasure
 Error measurement. More...
 
unsigned m_minPointCountPerCell
 Min number of points per cell (speed-up) More...
 
unsigned m_maxPointCountPerCell
 Max number of points per cell (speed-up) More...
 

Detailed Description

Proper KD-tree implementation.

Definition at line 23 of file TrueKdTree.h.

Member Typedef Documentation

◆ LeafVector

A vector of leaves.

Definition at line 105 of file TrueKdTree.h.

Constructor & Destructor Documentation

◆ TrueKdTree()

TrueKdTree::TrueKdTree ( GenericIndexedCloudPersist cloud)
explicit

Default constructor.

Definition at line 17 of file TrueKdTree.cpp.

References m_associatedCloud.

◆ ~TrueKdTree()

TrueKdTree::~TrueKdTree ( )

Destructor.

Definition at line 27 of file TrueKdTree.cpp.

References clear().

Member Function Documentation

◆ associatedCloud()

GenericIndexedCloudPersist* cloudViewer::TrueKdTree::associatedCloud ( ) const
inline

Returns the associated cloud.

Definition at line 114 of file TrueKdTree.h.

◆ build()

bool TrueKdTree::build ( double  maxError,
DistanceComputationTools::ERROR_MEASURES  errorMeasure = DistanceComputationTools::RMS,
unsigned  minPointCountPerCell = 3,
unsigned  maxPointCountPerCell = 0,
GenericProgressCallback progressCb = nullptr 
)

Builds KD-tree.

Parameters
maxErrormaximum error per cell (relatively to the best LS plane fit)
errorMeasureerror measurement
minPointCountPerCellminimum number of points per cell (can't be smaller than 3)
maxPointCountPerCellmaximum number of points per cell (speed-up - ignored if < 6)
progressCbthe client application can get some notification of the process progress through this callback mechanism (see GenericProgressCallback)

Definition at line 247 of file TrueKdTree.cpp.

References cloudViewer::ReferenceCloud::addPointIndex(), count, InitProgress(), m_associatedCloud, m_errorMeasure, m_maxError, m_maxPointCountPerCell, m_minPointCountPerCell, m_root, s_sortedCoordsForSplit, cloudViewer::GenericCloud::size(), and split().

Referenced by qFacets::extractFacets().

◆ clear()

void TrueKdTree::clear ( )

Clears structure.

Definition at line 29 of file TrueKdTree.cpp.

References m_root.

Referenced by ~TrueKdTree().

◆ getLeaves()

bool TrueKdTree::getLeaves ( LeafVector leaves) const

Returns all leaf nodes.

Definition at line 321 of file TrueKdTree.cpp.

References m_root, and GetLeavesVisitor::visit().

Referenced by ccKdTreeForFacetExtraction::FuseCells().

◆ getMaxError()

double cloudViewer::TrueKdTree::getMaxError ( ) const
inline

Returns max error threshold used for planarity-based split strategy.

Definition at line 138 of file TrueKdTree.h.

Referenced by ccPropertiesTreeDelegate::fillWithPointKdTree().

◆ getMaxErrorType()

DistanceComputationTools::ERROR_MEASURES cloudViewer::TrueKdTree::getMaxErrorType ( ) const
inline

Returns max error estimator used for planarity-based split strategy.

Definition at line 141 of file TrueKdTree.h.

Referenced by ccPropertiesTreeDelegate::fillWithPointKdTree().

◆ split()

Member Data Documentation

◆ LEAF_TYPE

const uint8_t cloudViewer::TrueKdTree::LEAF_TYPE = 1
static

Definition at line 30 of file TrueKdTree.h.

◆ m_associatedCloud

GenericIndexedCloudPersist* cloudViewer::TrueKdTree::m_associatedCloud
protected

Associated cloud.

Definition at line 156 of file TrueKdTree.h.

Referenced by build(), and TrueKdTree().

◆ m_errorMeasure

DistanceComputationTools::ERROR_MEASURES cloudViewer::TrueKdTree::m_errorMeasure
protected

Error measurement.

Definition at line 162 of file TrueKdTree.h.

Referenced by build(), and split().

◆ m_maxError

double cloudViewer::TrueKdTree::m_maxError
protected

Max error for planarity-based split strategy (see m_errorMeasure)

Definition at line 159 of file TrueKdTree.h.

Referenced by build(), and split().

◆ m_maxPointCountPerCell

unsigned cloudViewer::TrueKdTree::m_maxPointCountPerCell
protected

Max number of points per cell (speed-up)

Ignored if < 6

Definition at line 172 of file TrueKdTree.h.

Referenced by build(), and split().

◆ m_minPointCountPerCell

unsigned cloudViewer::TrueKdTree::m_minPointCountPerCell
protected

Min number of points per cell (speed-up)

Can't be < 3

Definition at line 167 of file TrueKdTree.h.

Referenced by build(), and split().

◆ m_root

BaseNode* cloudViewer::TrueKdTree::m_root
protected

Root node.

Definition at line 153 of file TrueKdTree.h.

Referenced by build(), clear(), and getLeaves().

◆ NODE_TYPE

const uint8_t cloudViewer::TrueKdTree::NODE_TYPE = 0
static

Definition at line 29 of file TrueKdTree.h.

◆ X_DIM

const uint8_t cloudViewer::TrueKdTree::X_DIM = 0
static

Definition at line 26 of file TrueKdTree.h.

Referenced by split().

◆ Y_DIM

const uint8_t cloudViewer::TrueKdTree::Y_DIM = 1
static

Definition at line 27 of file TrueKdTree.h.

Referenced by split().

◆ Z_DIM

const uint8_t cloudViewer::TrueKdTree::Z_DIM = 2
static

Definition at line 28 of file TrueKdTree.h.

Referenced by split().


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