//KDTreeSingleIndexParams(适合低维的情况) When passing an object of this type the index will contain a single kd-tree optimized for searching lower dimensionality data (for example 3D point clouds)
//KDTreeIndexParams When passing an object of this type the index constructed will consist of a set of randomized kd-trees which will be searched in parallel.
//KDTreeIndexParams When passing an object of this type the index constructed will consist of a set of randomized kd-trees which will be searched in parallel.
flann::Matrix<float> dataset(new float[N*dim], N, dim);
TriMesh::Point p;
for (TriMesh::VertexIter vit = mesh.vertices_begin(); vit != mesh.vertices_end(); vit++)
{
p = mesh.point(*vit);
dataset[vit->idx()][0] = p[0];
dataset[vit->idx()][1] = p[1];
dataset[vit->idx()][2] = p[2];
}
//L2----欧氏距离的平方
flann::Index< L2<float> > flann_index(dataset, flann::KDTreeSingleIndexParams(10));
flann_index.buildIndex();
std::vector<std::vector<int>>indices;
std::vector<std::vector<float>>dists;
flann_index.radiusSearch(dataset, indices, dists, radius, flann::SearchParams(128)); //搜索该半径范围以内所有的点的索引