A nearest neighbors datastructure that uses linear search. More...
#include <hpp/fcl/knn/nearest_neighbors_linear.h>
Classes | |
struct | ElemSort |
Public Member Functions | |
NearestNeighborsLinear (void) | |
virtual | ~NearestNeighborsLinear (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. | |
virtual void | nearestK (const _T &data, std::size_t k, std::vector< _T > &nbh) const |
Get the k-nearest neighbors of a point. | |
virtual void | nearestR (const _T &data, double radius, std::vector< _T > &nbh) const |
Get the nearest neighbors of a point, within a specified radius. | |
virtual std::size_t | size (void) const |
Get the number of elements in the datastructure. | |
virtual void | list (std::vector< _T > &data) const |
Get all the elements in the datastructure. | |
Protected Attributes | |
std::vector< _T > | data_ |
The data elements stored in this structure. |
A nearest neighbors datastructure that uses linear search.
fcl::NearestNeighborsLinear< _T >::NearestNeighborsLinear | ( | void | ) | [inline] |
virtual fcl::NearestNeighborsLinear< _T >::~NearestNeighborsLinear | ( | void | ) | [inline, virtual] |
virtual void fcl::NearestNeighborsLinear< _T >::add | ( | const _T & | data | ) | [inline, virtual] |
Add an element to the datastructure.
Implements fcl::NearestNeighbors< _T >.
Reimplemented in fcl::NearestNeighborsSqrtApprox< _T >.
References fcl::NearestNeighborsLinear< _T >::data_.
virtual void fcl::NearestNeighborsLinear< _T >::add | ( | const std::vector< _T > & | data | ) | [inline, virtual] |
Add a vector of points.
Reimplemented from fcl::NearestNeighbors< _T >.
Reimplemented in fcl::NearestNeighborsSqrtApprox< _T >.
References fcl::NearestNeighborsLinear< _T >::data_.
virtual void fcl::NearestNeighborsLinear< _T >::clear | ( | void | ) | [inline, virtual] |
Clear the datastructure.
Implements fcl::NearestNeighbors< _T >.
Reimplemented in fcl::NearestNeighborsSqrtApprox< _T >.
References fcl::NearestNeighborsLinear< _T >::data_.
virtual void fcl::NearestNeighborsLinear< _T >::list | ( | std::vector< _T > & | data | ) | const [inline, virtual] |
Get all the elements in the datastructure.
Implements fcl::NearestNeighbors< _T >.
References fcl::NearestNeighborsLinear< _T >::data_.
virtual _T fcl::NearestNeighborsLinear< _T >::nearest | ( | const _T & | data | ) | const [inline, virtual] |
Get the nearest neighbor of a point.
Implements fcl::NearestNeighbors< _T >.
Reimplemented in fcl::NearestNeighborsSqrtApprox< _T >.
References fcl::NearestNeighborsLinear< _T >::data_, fcl::distance(), and fcl::NearestNeighbors< _T >::distFun_.
virtual void fcl::NearestNeighborsLinear< _T >::nearestK | ( | const _T & | data, |
std::size_t | k, | ||
std::vector< _T > & | nbh | ||
) | const [inline, virtual] |
Get the k-nearest neighbors of a point.
Implements fcl::NearestNeighbors< _T >.
References fcl::NearestNeighborsLinear< _T >::data_.
virtual void fcl::NearestNeighborsLinear< _T >::nearestR | ( | const _T & | data, |
double | radius, | ||
std::vector< _T > & | nbh | ||
) | const [inline, virtual] |
Get the nearest neighbors of a point, within a specified radius.
Implements fcl::NearestNeighbors< _T >.
References fcl::NearestNeighborsLinear< _T >::data_.
virtual bool fcl::NearestNeighborsLinear< _T >::remove | ( | const _T & | data | ) | [inline, virtual] |
Remove an element from the datastructure.
Implements fcl::NearestNeighbors< _T >.
Reimplemented in fcl::NearestNeighborsSqrtApprox< _T >.
References fcl::NearestNeighborsLinear< _T >::data_.
virtual std::size_t fcl::NearestNeighborsLinear< _T >::size | ( | void | ) | const [inline, virtual] |
Get the number of elements in the datastructure.
Implements fcl::NearestNeighbors< _T >.
References fcl::NearestNeighborsLinear< _T >::data_.
Referenced by fcl::NearestNeighborsSqrtApprox< _T >::nearest(), and fcl::NearestNeighborsSqrtApprox< _T >::updateCheckCount().
std::vector<_T> fcl::NearestNeighborsLinear< _T >::data_ [protected] |
The data elements stored in this structure.
Referenced by fcl::NearestNeighborsLinear< _T >::add(), fcl::NearestNeighborsLinear< _T >::clear(), fcl::NearestNeighborsLinear< _T >::list(), fcl::NearestNeighborsLinear< _T >::nearest(), fcl::NearestNeighborsLinear< _T >::nearestK(), fcl::NearestNeighborsLinear< _T >::nearestR(), fcl::NearestNeighborsLinear< _T >::remove(), and fcl::NearestNeighborsLinear< _T >::size().