|
| KdTreeSearch (const PointCloud *cloud) |
| Constructor.
|
|
| KdTreeSearch (const std::vector< vec3 > &points) |
| Constructor.
|
|
|
virtual int | find_closest_point (const vec3 &p, float &squared_distance) const =0 |
| Queries the closest point for a given point.
|
|
virtual int | find_closest_point (const vec3 &p) const =0 |
| Queries the closest point for a given point.
|
|
|
virtual void | find_closest_k_points (const vec3 &p, int k, std::vector< int > &neighbors, std::vector< float > &squared_distances) const =0 |
| Queries the K nearest neighbors for a given point.
|
|
virtual void | find_closest_k_points (const vec3 &p, int k, std::vector< int > &neighbors) const =0 |
| Queries the K nearest neighbors for a given point.
|
|
|
virtual void | find_points_in_range (const vec3 &p, float squared_radius, std::vector< int > &neighbors, std::vector< float > &squared_distances) const =0 |
| Queries the nearest neighbors within a fixed range.
|
|
virtual void | find_points_in_range (const vec3 &p, float squared_radius, std::vector< int > &neighbors) const =0 |
| Queries the nearest neighbors within a fixed range.
|
|
Base class for nearest neighbor search using KdTree.
- See also
- KdTreeSearch_ANN, KdTreeSearch_ETH, KdTreeSearch_FLANN, and KdTreeSearch_NanoFLANN
Easy3D has a collection of KdTree implementations, including ANN, ETH, FLANN, and NanoFLANN and tried to get the best performance of each implementation. Runtime tests (on Windows, using a Visual C++ 2008, release build) indicated that the ETH implementation has the best performance. Bellow is the statistic summary of the test on two point clouds.
- Build: time for constructing the kd-tree.
- Single: time for querying closest vertex (for each point in the point cloud).
- KNN: time for querying K(=16) closest vertex.
- Radius: time for querying closest vertex within a radius.
Test 1: 362, 271 points (the Stanford bunny). radius = 0.001
--------------------------------------------------------------------------------------
Build | Single | KNN | Radius
--------------------|---------------------|--------------------|---------------------
ANN ETH FLANN | ANN ETH FLANN | ANN ETH FLANN | ANN ETH FLANN
--------------------|---------------------|--------------------|---------------------
0.14 0.05 0.12 | 0.17 0.11 0.71 | 1.33 1.0 1.48 | 1.32 1.01 1.51
--------------------------------------------------------------------------------------
Test 2: 4, 116, 466 points (an noisy urban scan). radius = 0.03
--------------------------------------------------------------------------------------
Build | Single | KNN | Radius
--------------------|---------------------|---------------------|---------------------
ANN ETH FLANN | ANN ETH FLANN | ANN ETH FLANN | ANN ETH FLANN
--------------------|---------------------|---------------------|---------------------
2.2 0.76 1.88 | 2.61 1.84 11.8 | 20.8 13.5 22.0 | 8.75 4.79 15.1
--------------------------------------------------------------------------------------
- Attention
- KdTreeSearch_FLANN and KdTreeSearch_NanoFLANN are thread-safe. Others seem not (not tested yet).