A nearest neighbors datastructure that uses linear search. More...
#include <hpp/fcl/knn/nearest_neighbors_sqrtapprox.h>
Public Member Functions | |
NearestNeighborsSqrtApprox (void) | |
virtual | ~NearestNeighborsSqrtApprox (void) |
virtual void | clear (void) |
Clear the datastructure. | |
virtual void | add (const _T &data) |
Add an element to the datastructure. | |
virtual void | add (const std::vector< _T > &data) |
Add a vector of points. | |
virtual bool | remove (const _T &data) |
Remove an element from the datastructure. | |
virtual _T | nearest (const _T &data) const |
Get the nearest neighbor of a point. | |
Protected Member Functions | |
void | updateCheckCount (void) |
The maximum number of checks to perform when searching for a nearest neighbor. | |
Protected Attributes | |
std::size_t | checks_ |
The number of checks to be performed when looking for a nearest neighbor. | |
std::size_t | offset_ |
The offset to start checking at (between 0 and checks_) |
A nearest neighbors datastructure that uses linear search.
The linear search is done over sqrt(n) elements only. (Every sqrt(n) elements are skipped).
fcl::NearestNeighborsSqrtApprox< _T >::NearestNeighborsSqrtApprox | ( | void | ) | [inline] |
virtual fcl::NearestNeighborsSqrtApprox< _T >::~NearestNeighborsSqrtApprox | ( | void | ) | [inline, virtual] |
virtual void fcl::NearestNeighborsSqrtApprox< _T >::add | ( | const _T & | data | ) | [inline, virtual] |
Add an element to the datastructure.
Reimplemented from fcl::NearestNeighborsLinear< _T >.
References fcl::NearestNeighborsSqrtApprox< _T >::updateCheckCount().
Referenced by fcl::NearestNeighborsSqrtApprox< _T >::add().
virtual void fcl::NearestNeighborsSqrtApprox< _T >::add | ( | const std::vector< _T > & | data | ) | [inline, virtual] |
Add a vector of points.
Reimplemented from fcl::NearestNeighborsLinear< _T >.
References fcl::NearestNeighborsSqrtApprox< _T >::add(), and fcl::NearestNeighborsSqrtApprox< _T >::updateCheckCount().
virtual void fcl::NearestNeighborsSqrtApprox< _T >::clear | ( | void | ) | [inline, virtual] |
Clear the datastructure.
Reimplemented from fcl::NearestNeighborsLinear< _T >.
References fcl::NearestNeighborsSqrtApprox< _T >::checks_, and fcl::NearestNeighborsSqrtApprox< _T >::offset_.
virtual _T fcl::NearestNeighborsSqrtApprox< _T >::nearest | ( | const _T & | data | ) | const [inline, virtual] |
Get the nearest neighbor of a point.
Reimplemented from fcl::NearestNeighborsLinear< _T >.
References fcl::NearestNeighborsSqrtApprox< _T >::checks_, fcl::distance(), fcl::NearestNeighbors< _T >::distFun_, fcl::NearestNeighborsSqrtApprox< _T >::offset_, and fcl::NearestNeighborsLinear< _T >::size().
virtual bool fcl::NearestNeighborsSqrtApprox< _T >::remove | ( | const _T & | data | ) | [inline, virtual] |
Remove an element from the datastructure.
Reimplemented from fcl::NearestNeighborsLinear< _T >.
References fcl::NearestNeighborsSqrtApprox< _T >::updateCheckCount().
void fcl::NearestNeighborsSqrtApprox< _T >::updateCheckCount | ( | void | ) | [inline, protected] |
The maximum number of checks to perform when searching for a nearest neighbor.
References fcl::NearestNeighborsSqrtApprox< _T >::checks_, and fcl::NearestNeighborsLinear< _T >::size().
Referenced by fcl::NearestNeighborsSqrtApprox< _T >::add(), and fcl::NearestNeighborsSqrtApprox< _T >::remove().
std::size_t fcl::NearestNeighborsSqrtApprox< _T >::checks_ [protected] |
The number of checks to be performed when looking for a nearest neighbor.
Referenced by fcl::NearestNeighborsSqrtApprox< _T >::clear(), fcl::NearestNeighborsSqrtApprox< _T >::nearest(), and fcl::NearestNeighborsSqrtApprox< _T >::updateCheckCount().
std::size_t fcl::NearestNeighborsSqrtApprox< _T >::offset_ [mutable, protected] |
The offset to start checking at (between 0 and checks_)
Referenced by fcl::NearestNeighborsSqrtApprox< _T >::clear(), and fcl::NearestNeighborsSqrtApprox< _T >::nearest().