![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <knncpp.h>
Public Types | |
| typedef _Scalar | Scalar |
| typedef _Distance | Distance |
| typedef Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > | Matrix |
| typedef Eigen::Matrix< Scalar, _Dimension, Eigen::Dynamic > | DataMatrix |
| typedef Eigen::Matrix< Scalar, _Dimension, 1 > | DataVector |
| typedef knncpp::Matrixi | Matrixi |
Public Member Functions | |
| KDTreeMinkowski () | |
| KDTreeMinkowski (const DataMatrix &data, const bool copy=false) | |
| void | setBucketSize (const Index bucketSize) |
| void | setSorted (const bool sorted) |
| void | setBalanced (const bool balanced) |
| void | setTakeRoot (const bool takeRoot) |
| void | setCompact (const bool compact) |
| void | setThreads (const unsigned int threads) |
| void | setMaxDistance (const Scalar maxDist) |
| void | setData (const DataMatrix &data, const bool copy=false) |
| void | setDistance (const Distance &distance) |
| void | build () |
| template<typename Derived > | |
| void | query (const Eigen::MatrixBase< Derived > &queryPoints, const size_t knn, Matrixi &indices, Matrix &distances) const |
| void | clear () |
| Index | size () const |
| Index | dimension () const |
| Index | depth () const |
Class for performing k nearest neighbour searches with minkowski distances. This kdtree only works reliably with the minkowski distance and its special cases like manhatten or euclidean distance.
| typedef Eigen::Matrix<Scalar, _Dimension, Eigen::Dynamic> knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::DataMatrix |
| typedef Eigen::Matrix<Scalar, _Dimension, 1> knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::DataVector |
| typedef _Distance knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::Distance |
| typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::Matrix |
| typedef knncpp::Matrixi knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::Matrixi |
| typedef _Scalar knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::Scalar |
|
inline |
Constructs an empty KDTree.
|
inline |
Constructs KDTree with the given data. This does not build the the index of the tree.
| data | NxM matrix, M points of dimension N |
| copy | if true copies the data, otherwise assumes static data |
References copy, data, and knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::setData().
|
inline |
Builds the search index of the tree. Data has to be set and must be non-empty.
References knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::clear().
Referenced by knn_cpp_nearest_neighbors().
|
inline |
Clears the tree.
Referenced by knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::build(), and knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::setData().
|
inline |
Returns the maxximum depth of the tree.
|
inline |
Returns the dimension of the data points in the search index.
Referenced by knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::query().
|
inline |
Queries the tree for the nearest neighbours of the given query points.
The tree has to be built before it can be queried.
The query points have to have the same dimension as the data points of the tree.
The result matrices will be resized appropriatley. Indices and distances will be set to -1 if less than knn neighbours were found.
| queryPoints | NxM matrix, M points of dimension N |
| knn | amount of neighbours to be found |
| indices | KNNxM matrix, indices of neighbours in the data set |
| distances | KNNxM matrix, distance between query points and neighbours |
References knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::dimension(), and knncpp::QueryHeap< Scalar >::sort().
Referenced by knn_cpp_nearest_neighbors().
|
inline |
Set if the tree should be built as balanced as possible. This increases build time, but decreases search time.
| balanced | set true to build a balanced tree |
|
inline |
Set the maximum amount of data points per leaf in the tree (aka bucket size).
| bucketSize | amount of points per leaf. |
Referenced by knn_cpp_nearest_neighbors().
|
inline |
Set if the tree should be built with compact leaf nodes. This increases build time, but makes leaf nodes denser (more) points. Thus less visits are necessary.
| compact | set true ti build a tree with compact leafs |
|
inline |
Set the data points used for this tree. This does not build the tree.
| data | NxM matrix, M points of dimension N |
| copy | if true data is copied, assumes static data otherwise |
References knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::clear(), copy, and data.
Referenced by knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::KDTreeMinkowski().
|
inline |
References Utils::distance().
|
inline |
Set the maximum distance for querying the tree. The search will be pruned if the maximum distance is set to any positive number.
| maxDist | maximum distance, <= 0 for no limit |
|
inline |
Set if the points returned by the queries should be sorted according to their distance to the query points.
| sorted | sort query results |
Referenced by knn_cpp_nearest_neighbors().
|
inline |
Set if the distances after the query should be rooted or not. Taking the root of the distances increases query time, but the function will return true distances instead of their powered versions.
| takeRoot | set true if root should be taken else false |
|
inline |
Set the amount of threads that should be used for building and querying the tree. OpenMP has to be enabled for this to work.
| threads | amount of threads, 0 for optimal choice |
Referenced by knn_cpp_nearest_neighbors().
|
inline |
Returns the amount of data points stored in the search index.