trivial.cpp
Go to the documentation of this file.
1 // This example is in the public domain
2 
3 #include "nabo/nabo.h"
4 
5 int main()
6 {
7  using namespace Nabo;
8  using namespace Eigen;
9 
10  // 100 points in 3D
11  MatrixXf M = MatrixXf::Random(3, 100);
12  // 1 query points
13  VectorXf q = VectorXf::Random(3);
14 
15  // create a kd-tree for M, note that M must stay valid during the lifetime of the kd-tree
17 
18  // look for the 5 nearest neighbour of a the single-point query
19  const int K = 5;
20  VectorXi indices(K);
21  VectorXf dists2(K);
22  nns->knn(q, indices, dists2, K);
23 
24  // cleanup kd-tree
25  delete nns;
26 
27  return 0;
28 }
int main()
Definition: trivial.cpp:5
Nearest neighbour search interface, templatized on scalar type.
Definition: nabo.h:258
nns
Definition: test.py:7
Namespace for Nabo.
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/nabo.cpp:166
public interface
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/nabo.cpp:83
q
Definition: test.py:8


libnabo
Author(s): Stéphane Magnenat
autogenerated on Mon Feb 28 2022 22:41:38