nanoflann icon indicating copy to clipboard operation
nanoflann copied to clipboard

why nanoflann is solwer than flann when i use radius search and there is bug

Open luck-boy1994 opened this issue 3 years ago • 1 comments

error C2228: ".resize" must have a class/structure/union on the left Appears in nanoflann line 90 error C2228: “.assign”must have a class/structure/union on the left

my code 👍 clock_t start1 = clock(); float *query_pt = new float[3]; query_pt[0] = mycloud.pts[i].x; query_pt[1] = mycloud.pts[i].y; query_pt[2] = mycloud.pts[i].z; const float search_radius = static_cast(12); std::vector<std::pair<size_t, float> > ret_matches;

nanoflann::SearchParams params;
//params.sorted = false;

const size_t nMatches = index.radiusSearch(&query_pt[0], search_radius, ret_matches, params);

cout << "radiusSearch(): radius=" << search_radius << " -> " << nMatches << " matches\n";
index.freeIndex(index);
clock_t end1 = clock();
cout << "nano time=" << (end1 - start1) << "ms" << endl;

When I use pcl for neighborhood search, the number of search points is 1472 and the time is 6ms. But when using nanoflann, the number of points is 209 and the time is 17ms.

luck-boy1994 avatar Dec 10 '20 13:12 luck-boy1994

Hi! I guess you probably missed this message in the doc

Important note: If L2 norms are used, notice that search radius and all passed and returned distances are actually squared distances.

Also check #128 .

I think the definition of L2 norm in nanoflann is really bad. Most people would make a mistake here.

jingchangshi avatar Jan 22 '21 12:01 jingchangshi