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 }
Nabo
Namespace for Nabo.
Definition: experimental/kdtree_cpu.cpp:40
nabo.h
public interface
Nabo::NearestNeighbourSearch::createKDTreeLinearHeap
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
Nabo::NearestNeighbourSearch
Nearest neighbour search interface, templatized on scalar type.
Definition: nabo.h:258
test.nns
nns
Definition: test.py:7
test.q
q
Definition: test.py:8
main
int main()
Definition: trivial.cpp:5


libnabo
Author(s): Stéphane Magnenat
autogenerated on Fri Aug 2 2024 08:39:11