C3D Toolkit  Kernel - 117982, Vision - 2.9.2.2

K-d tree. More...

#include <templ_kdtree.h>

+ Collaboration diagram for KdTree< Scalar >:

Public Member Functions

 KdTree (const PointList &points, size_t minLeafSize=16, size_t maxDepth=64, bool balanced=false)
 Constructor. More...
 
 ~KdTree ()
 Destructor.
 
Functions of priority queue.
void GetKNearestNeighbors (const MbCartPoint3D &queryPoint, size_t neighborCount, ScalarPriorityQueue &neighborQueue)
 Performs the k-nearest neighbors (kNN) query. More...
 
void GetRadiusNeighbors (const MbCartPoint3D &queryPoint, double radius, const c3d::BoolVector &used, c3d::IndicesVector &neighbors)
 Performs the query for neighbors inside given sphere. More...
 
const NodeList & GetNodes ()
 Get tree nodes.
 
const PointList & GetPoints ()
 Get points set.
 
const IndexList & GetIndices ()
 Get indices of points.
 
size_t GetNumLevel ()
 Get depth of tree.
 
const MbCubeGetAxisAlignedBox ()
 Get axis aligned bounding box.
 

Protected Attributes

MbCube box
 Bounding box.
 
NodeList nodes
 Nodes of tree.
 
PointList points
 Set of points.
 
IndexList indices
 Indices of points.
 
size_t targetCellSize
 Minimal number of point in a tree leaf.
 
size_t targetMaxDepth
 Maximal tree depth.
 
size_t numLevel
 Tree depth.
 
bool isBalanced
 Three is balanced or unbalanced.
 

Detailed Description

template<class Scalar>
class KdTree< Scalar >

K-d tree.

K-d binary tree.

Constructor & Destructor Documentation

◆ KdTree()

template<class Scalar >
KdTree< Scalar >::KdTree ( const PointList &  points,
size_t  minLeafSize = 16,
size_t  maxDepth = 64,
bool  balanced = false 
)

Constructor.

Constructor of k-d tree.

Parameters
[in]points- Set of points.
[in]minLeafSize- Minimal number of point in a tree leaf (16 by default).
[in]maxDepth- Maximal tree depth (64 by default).
[in]balanced- Create three balanced or unbalanced (unbalanced by default).

Member Function Documentation

◆ GetKNearestNeighbors()

template<class Scalar >
void KdTree< Scalar >::GetKNearestNeighbors ( const MbCartPoint3D queryPoint,
size_t  neighborCount,
ScalarPriorityQueue neighborQueue 
)

Performs the k-nearest neighbors (kNN) query.

Performs the k-nearest neighbors (kNN) query.

Parameters
[in]queryPoint- The point for which the neighbors are being searched for .
[in]neighborCount- Number of neighbors requested.
[in]neighborQueue- Queue with k-nearest neighbors (kNN) query results, where the topmost element [0] is NOT the nearest but the farthest

◆ GetRadiusNeighbors()

template<class Scalar >
void KdTree< Scalar >::GetRadiusNeighbors ( const MbCartPoint3D queryPoint,
double  radius,
const c3d::BoolVector used,
c3d::IndicesVector neighbors 
)

Performs the query for neighbors inside given sphere.

Performs the query for neighbors inside given sphere.

Parameters
[in]queryPoint- The point for which the neighbors are being searched for .
[in]radius- Sphere radius.
[in]used- Points filter. Value true implies that point is excluded from consideration.
[out]neighbors- Neigbors array.

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