![]() |
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 |
|
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 |
Definition at line 926 of file knncpp.h.
References copy, 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.
Definition at line 988 of file knncpp.h.
References knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::clear(), and length().
Referenced by knn_cpp_nearest_neighbors().
|
inline |
Clears the tree.
Definition at line 1088 of file knncpp.h.
Referenced by knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::build(), and knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::setData().
|
inline |
|
inline |
Returns the dimension of the data points in the search index.
Definition at line 1096 of file knncpp.h.
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 |
Definition at line 1029 of file knncpp.h.
References knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::dimension(), and knncpp::QueryHeap< Scalar >::sort().
Referenced by knn_cpp_nearest_neighbors().
|
inline |
|
inline |
Set the maximum amount of data points per leaf in the tree (aka bucket size).
| bucketSize | amount of points per leaf. |
Definition at line 933 of file knncpp.h.
Referenced by knn_cpp_nearest_neighbors().
|
inline |
|
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 |
Definition at line 974 of file knncpp.h.
References knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::clear(), and copy.
Referenced by knncpp::KDTreeMinkowski< _Scalar, _Dimension, _Distance >::KDTreeMinkowski().
|
inline |
|
inline |
|
inline |
Set if the points returned by the queries should be sorted according to their distance to the query points.
| sorted | sort query results |
Definition at line 938 of file knncpp.h.
Referenced by knn_cpp_nearest_neighbors().
|
inline |
|
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 |
Definition at line 962 of file knncpp.h.
Referenced by knn_cpp_nearest_neighbors().
|
inline |