a kd-Tree Implementation for nearest Neighbor searches
More...
#include <KDTree.hpp>
|
| template<typename T > |
| bool | nearestNeighbor (const Vector3< T > &point, Neighbor &neighbor, double &distance, double maxDistance=std::numeric_limits< double >::infinity()) const |
| | Finds the nearest neighbor of 'point' that is within 'maxDistance' (defaults to infinity). The resulting neighbor is written into 'neighbor' (or nullptr if none is found). More...
|
| |
| virtual | ~KDTree ()=default |
| |
a kd-Tree Implementation for nearest Neighbor searches
Definition at line 51 of file KDTree.hpp.
◆ KDTreePtr
◆ Neighbor
◆ Point
◆ PointT
◆ ~KDTree()
| virtual lvr2::KDTree::~KDTree |
( |
| ) |
|
|
virtualdefault |
◆ KDTree() [1/2]
◆ KDTree() [2/2]
| lvr2::KDTree::KDTree |
( |
const KDTree && |
| ) |
|
|
protecteddelete |
◆ create()
Creates a new KDTree from the given Scan.
- Parameters
-
| points | The Point Cloud |
| n | The number of points in 'points' |
| maxLeafSize | The maximum number of points to use for a Leaf in the Tree |
Definition at line 153 of file KDTree.cpp.
◆ nearestNeighbor()
template<typename T >
| bool lvr2::KDTree::nearestNeighbor |
( |
const Vector3< T > & |
point, |
|
|
Neighbor & |
neighbor, |
|
|
double & |
distance, |
|
|
double |
maxDistance = std::numeric_limits<double>::infinity() |
|
) |
| const |
|
inline |
Finds the nearest neighbor of 'point' that is within 'maxDistance' (defaults to infinity). The resulting neighbor is written into 'neighbor' (or nullptr if none is found).
- Parameters
-
| point | The Point whose neighbor is searched |
| neighbor | A Pointer that is set to the neighbor or nullptr if none is found |
| distance | The final distance between point and neighbor |
| maxDistance | The maximum distance allowed between neighbors. Setting this value significantly speeds up the search. |
- Returns
- bool true if a neighbors was found, false otherwise
Definition at line 80 of file KDTree.hpp.
◆ nearestNeighbors() [1/2]
Finds the nearest neighbors of all points in a Scan using a pre-generated KDTree.
- Parameters
-
| tree | The KDTree to search in |
| scan | The Scan to search for |
| neighbors | An array to store the results in. neighbors[i] is set to a Pointer to the neighbor of points[i] or nullptr if none was found |
| maxDistance | The maximum Distance for a Neighbor |
| centroid_m | Will be set to the average of all Points in 'neighbors' |
| centroid_d | Will be set to the average of all Points in 'points' that have neighbors |
- Returns
- size_t The number of neighbors that were found
Definition at line 176 of file KDTree.cpp.
◆ nearestNeighbors() [2/2]
Finds the nearest neighbors of all points in a Scan using a pre-generated KDTree.
- Parameters
-
| tree | The KDTree to search in |
| scan | The Scan to search for |
| neighbors | An array to store the results in. neighbors[i] is set to a Pointer to the neighbor of points[i] or nullptr if none was found |
| maxDistance | The maximum Distance for a Neighbor |
- Returns
- size_t The number of neighbors that were found
Definition at line 198 of file KDTree.cpp.
◆ nnInternal()
| virtual void lvr2::KDTree::nnInternal |
( |
const Point & |
point, |
|
|
Neighbor & |
neighbor, |
|
|
double & |
maxDist |
|
) |
| const |
|
protectedpure virtual |
◆ KDNode
◆ points
| boost::shared_array<Point> lvr2::KDTree::points |
|
protected |
The documentation for this class was generated from the following files: