trivial.cpp
Go to the documentation of this file.
00001 // This example is in the public domain
00002 
00003 #include "nabo/nabo.h"
00004 
00005 int main()
00006 {
00007         using namespace Nabo;
00008         using namespace Eigen;
00009         
00010         // 100 points in 3D
00011         MatrixXf M = MatrixXf::Random(3, 100);
00012         // 1 query points
00013         VectorXf q = VectorXf::Random(3);
00014         
00015         // create a kd-tree for M, note that M must stay valid during the lifetime of the kd-tree
00016         NNSearchF* nns = NNSearchF::createKDTreeLinearHeap(M);
00017         
00018         // look for the 5 nearest neighbour of a the single-point query
00019         const int K = 5;
00020         VectorXi indices(K);
00021         VectorXf dists2(K);
00022         nns->knn(q, indices, dists2, K);
00023         
00024         // cleanup kd-tree
00025         delete nns;
00026         
00027         return 0;
00028 }


libnabo
Author(s): Stéphane Magnenat
autogenerated on Sun Feb 10 2019 03:52:20