A nearest neighbors datastructure that uses linear search. More...
#include <ompl/datastructures/NearestNeighborsLinear.h>

Public Member Functions | |
void | clear () override |
Clear the datastructure. | |
bool | reportsSortedResults () const override |
Return true if the solutions reported by this data structure are sorted, when calling nearestK / nearestR. | |
void | add (const _T &data) override |
Add an element to the datastructure. | |
void | add (const std::vector< _T > &data) override |
Add a vector of points. | |
bool | remove (const _T &data) override |
Remove an element from the datastructure. | |
_T | nearest (const _T &data) const override |
Get the nearest neighbor of a point. | |
void | nearestK (const _T &data, std::size_t k, std::vector< _T > &nbh) const override |
Return the k nearest neighbors in sorted order. | |
void | nearestR (const _T &data, double radius, std::vector< _T > &nbh) const override |
Return the nearest neighbors within distance radius in sorted order. | |
std::size_t | size () const override |
Get the number of elements in the datastructure. | |
void | list (std::vector< _T > &data) const override |
Get all the elements in the datastructure. | |
![]() | |
virtual void | setDistanceFunction (const DistanceFunction &distFun) |
Set the distance function to use. | |
const DistanceFunction & | getDistanceFunction () const |
Get the distance function used. | |
Protected Attributes | |
std::vector< _T > | data_ |
The data elements stored in this structure. | |
![]() | |
DistanceFunction | distFun_ |
The used distance function. | |
Additional Inherited Members | |
![]() | |
using | DistanceFunction = std::function< double(const _T &, const _T &)> |
The definition of a distance function. | |
Detailed Description
class ompl::NearestNeighborsLinear< _T >
A nearest neighbors datastructure that uses linear search.
- Search for nearest neighbor is O(n).
- Search for k-nearest neighbors is O(n log(k)).
- Search for neighbors within a range is O(n log(n)).
- Adding an element to the datastructure is O(1).
- Removing an element from the datastructure O(n).
Definition at line 56 of file NearestNeighborsLinear.h.
Constructor & Destructor Documentation
◆ NearestNeighborsLinear()
|
inline |
Definition at line 59 of file NearestNeighborsLinear.h.
Member Function Documentation
◆ add() [1/2]
|
inlineoverridevirtual |
Add an element to the datastructure.
Implements ompl::NearestNeighbors< _T >.
Reimplemented in ompl::NearestNeighborsSqrtApprox< _T >.
Definition at line 75 of file NearestNeighborsLinear.h.
◆ add() [2/2]
|
inlineoverridevirtual |
Add a vector of points.
Reimplemented from ompl::NearestNeighbors< _T >.
Reimplemented in ompl::NearestNeighborsSqrtApprox< _T >.
Definition at line 80 of file NearestNeighborsLinear.h.
◆ clear()
|
inlineoverridevirtual |
Clear the datastructure.
Implements ompl::NearestNeighbors< _T >.
Reimplemented in ompl::NearestNeighborsSqrtApprox< _T >.
Definition at line 65 of file NearestNeighborsLinear.h.
◆ list()
|
inlineoverridevirtual |
Get all the elements in the datastructure.
Implements ompl::NearestNeighbors< _T >.
Definition at line 149 of file NearestNeighborsLinear.h.
◆ nearest()
|
inlineoverridevirtual |
Get the nearest neighbor of a point.
Implements ompl::NearestNeighbors< _T >.
Reimplemented in ompl::NearestNeighborsSqrtApprox< _T >.
Definition at line 98 of file NearestNeighborsLinear.h.
◆ nearestK()
|
inlineoverridevirtual |
Return the k nearest neighbors in sorted order.
Implements ompl::NearestNeighbors< _T >.
Definition at line 119 of file NearestNeighborsLinear.h.
◆ nearestR()
|
inlineoverridevirtual |
Return the nearest neighbors within distance radius
in sorted order.
Implements ompl::NearestNeighbors< _T >.
Definition at line 135 of file NearestNeighborsLinear.h.
◆ remove()
|
inlineoverridevirtual |
Remove an element from the datastructure.
Implements ompl::NearestNeighbors< _T >.
Reimplemented in ompl::NearestNeighborsSqrtApprox< _T >.
Definition at line 86 of file NearestNeighborsLinear.h.
◆ reportsSortedResults()
|
inlineoverridevirtual |
Return true if the solutions reported by this data structure are sorted, when calling nearestK / nearestR.
Implements ompl::NearestNeighbors< _T >.
Definition at line 70 of file NearestNeighborsLinear.h.
◆ size()
|
inlineoverridevirtual |
Get the number of elements in the datastructure.
Implements ompl::NearestNeighbors< _T >.
Definition at line 144 of file NearestNeighborsLinear.h.
Member Data Documentation
◆ data_
|
protected |
The data elements stored in this structure.
Definition at line 156 of file NearestNeighborsLinear.h.
The documentation for this class was generated from the following file:
- ompl/datastructures/NearestNeighborsLinear.h