36#if EIGEN_VERSION_AT_LEAST(2,92,0)
40 #include "Eigen/Array"
44#include "third_party/any.hpp"
211 #define NABO_VERSION "1.0.7"
213 #define NABO_VERSION_INT 10007
216 template <
typename IndexType>
217 inline constexpr IndexType invalidIndex() {
218 static_assert(std::is_integral<IndexType>::value,
"");
219 return std::is_unsigned<IndexType>::value ? std::numeric_limits<IndexType>::max() : IndexType(-1);
222 template <
typename ValueType>
223 inline constexpr ValueType invalidValue() {
224 static_assert(std::is_floating_point<ValueType>::value,
"");
225 return std::numeric_limits<ValueType>::infinity();
231 struct Parameters:
public std::map<std::string, linb::any>
246 T
get(
const std::string& key,
const T& defaultValue)
const
248 const_iterator it(find(key));
250 return linb::any_cast<T>(it->second);
257 template<
typename T,
typename Cloud_T = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic> >
261 typedef typename Eigen::Matrix<T, Eigen::Dynamic, 1>
Vector;
263 typedef typename Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>
Matrix;
269 typedef typename Eigen::Matrix<Index, Eigen::Dynamic, 1>
IndexVector;
271 typedef typename Eigen::Matrix<Index, Eigen::Dynamic, Eigen::Dynamic>
IndexMatrix;
391 template <
typename WrongMatrixType>
400 template <
typename WrongMatrixType>
409 template <
typename WrongMatrixType>
418 template <
typename WrongMatrixType>
446 typedef NearestNeighbourSearch<float>
NNSearchF;
448 typedef NearestNeighbourSearch<double>
NNSearchD;
Namespace for Nabo.
Definition brute_force_cpu.cpp:41
NearestNeighbourSearch< float > NNSearchF
nearest neighbour search with scalars of type float
Definition nabo.h:445
NearestNeighbourSearch< double > NNSearchD
nearest neighbour search with scalars of type double
Definition nabo.h:447
Nearest neighbour search interface, templatized on scalar type.
Definition nabo.h:258
static constexpr Index InvalidIndex
the invalid index
Definition nabo.h:284
NearestNeighbourSearch(const CloudType &cloud, const Index dim, const unsigned creationOptionFlags)
constructor
Definition nabo.cpp:69
void checkSizesKnn(const Matrix &query, const IndexMatrix &indices, const Matrix &dists2, const Index k, const unsigned optionFlags, const Vector *maxRadii=0) const
Make sure that the output matrices have the right sizes. Throw an exception otherwise.
Definition nabo.cpp:103
int Index
an index to a Vector or a Matrix, for refering to data points
Definition nabo.h:266
SearchOptionFlags
search option
Definition nabo.h:308
@ ALLOW_SELF_MATCH
allows the return of the same point as the query, if this point is in the data cloud; forbidden by de...
Definition nabo.h:309
@ SORT_RESULTS
sort points by distances, when k > 1; do not sort by default
Definition nabo.h:310
static NearestNeighbourSearch * createKDTreeLinearHeap(const CloudType &cloud, const Index dim=std::numeric_limits< Index >::max(), const unsigned creationOptionFlags=0, const Parameters &additionalParameters=Parameters())
Create a nearest-neighbour search, using a kd-tree with linear heap, good for small k (~up to 30)
Definition nabo.cpp:166
static NearestNeighbourSearch * create(const CloudType &cloud, const Index dim=std::numeric_limits< Index >::max(), const SearchType preferedType=KDTREE_LINEAR_HEAP, const unsigned creationOptionFlags=0, const Parameters &additionalParameters=Parameters())
Create a nearest-neighbour search.
Definition nabo.cpp:135
static NearestNeighbourSearch * createKDTreeTreeHeap(const CloudType &cloud, const Index dim=std::numeric_limits< Index >::max(), const unsigned creationOptionFlags=0, const Parameters &additionalParameters=Parameters())
Create a nearest-neighbour search, using a kd-tree with tree heap, good for large k (~from 30)
Definition nabo.cpp:174
Cloud_T CloudType
a column-major Eigen matrix in which each column is a point; this matrix has dim rows
Definition nabo.h:264
static NearestNeighbourSearch * createBruteForce(const CloudType &cloud, const Index dim=std::numeric_limits< Index >::max(), const unsigned creationOptionFlags=0)
Create a nearest-neighbour search, using brute-force search, useful for comparison only.
Definition nabo.cpp:158
const Vector maxBound
the high bound of the search space (axis-aligned bounding box)
Definition nabo.h:281
const CloudType & cloud
the reference to the data-point cloud, which must remain valid during the lifetime of the NearestNeig...
Definition nabo.h:273
const unsigned creationOptionFlags
creation options
Definition nabo.h:277
CreationOptionFlags
creation option
Definition nabo.h:302
@ TOUCH_STATISTICS
perform statistics on the number of points touched
Definition nabo.h:303
Eigen::Matrix< Index, Eigen::Dynamic, 1 > IndexVector
a vector of indices to data points
Definition nabo.h:268
static constexpr T InvalidValue
the invalid value
Definition nabo.h:286
const Index dim
the dimensionality of the data-point cloud
Definition nabo.h:275
Eigen::Matrix< Index, Eigen::Dynamic, Eigen::Dynamic > IndexMatrix
a matrix of indices to data points
Definition nabo.h:270
virtual ~NearestNeighbourSearch()
virtual destructor
Definition nabo.h:426
const Vector minBound
the low bound of the search space (axis-aligned bounding box)
Definition nabo.h:279
SearchType
type of search
Definition nabo.h:290
@ KDTREE_CL_PT_IN_LEAVES
kd-tree using openCL, pt in leaves, only available if OpenCL enabled, UNSTABLE API
Definition nabo.h:295
@ KDTREE_LINEAR_HEAP
kd-tree with linear heap, good for small k (~up to 30)
Definition nabo.h:292
@ KDTREE_CL_PT_IN_NODES
kd-tree using openCL, pt in nodes, only available if OpenCL enabled, UNSTABLE API
Definition nabo.h:294
@ BRUTE_FORCE_CL
brute-force using openCL, only available if OpenCL enabled, UNSTABLE API
Definition nabo.h:296
@ SEARCH_TYPE_COUNT
number of search types
Definition nabo.h:297
@ KDTREE_TREE_HEAP
kd-tree with tree heap, good for large k (~from 30)
Definition nabo.h:293
@ BRUTE_FORCE
brute force, check distance to every point in the data
Definition nabo.h:291
Eigen::Matrix< T, Eigen::Dynamic, 1 > Vector
an Eigen vector of type T, to hold the coordinates of a point
Definition nabo.h:260
Eigen::Matrix< T, Eigen::Dynamic, Eigen::Dynamic > Matrix
a column-major Eigen matrix in which each column is a point; this matrix has dim rows
Definition nabo.h:262
unsigned long knn(const Vector &query, IndexVector &indices, Vector &dists2, const Index k=1, const T epsilon=0, const unsigned optionFlags=0, const T maxRadius=std::numeric_limits< T >::infinity()) const
Find the k nearest neighbours of query.
Definition nabo.cpp:83
Parameter vector.
Definition nabo.h:231
T get(const std::string &key, const T &defaultValue) const
Get the value of a key, return defaultValue if the key does not exist.
Definition nabo.h:245
Parameters()
Create an empty parameter vector.
Definition nabo.h:233