C3D Toolkit
Kernel - 117982, Vision - 2.9.2.2
|
K-d tree. More...
#include <templ_kdtree.h>
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 MbCube & | GetAxisAlignedBox () |
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. | |
K-d tree.
K-d binary tree.
KdTree< Scalar >::KdTree | ( | const PointList & | points, |
size_t | minLeafSize = 16 , |
||
size_t | maxDepth = 64 , |
||
bool | balanced = false |
||
) |
Constructor.
Constructor of k-d tree.
[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). |
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.
[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 |
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.
[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. |