81 virtual void add(
const _T& data) = 0;
84 virtual void add(
const std::vector<_T>& data)
86 for (
auto elt = data.begin(); elt != data.end(); ++elt)
91 virtual bool remove(
const _T& data) = 0;
94 virtual _T
nearest(
const _T& data)
const = 0;
101 virtual void nearestK(
const _T& data, std::size_t k, std::vector<_T>& nbh)
const = 0;
108 virtual void nearestR(
const _T& data,
double radius, std::vector<_T>& nbh)
const = 0;
111 virtual std::size_t
size()
const = 0;
114 virtual void list(std::vector<_T>& data)
const = 0;
Abstract representation of a container that can perform nearest neighbors queries.
NearestNeighbors(NearestNeighbors &&) noexcept=default
NearestNeighbors()=default
virtual void nearestK(const _T &data, std::size_t k, std::vector< _T > &nbh) const =0
Get the k-nearest neighbors of a point.
virtual _T nearest(const _T &data) const =0
Get the nearest neighbor of a point.
virtual void add(const std::vector< _T > &data)
Add a vector of points.
virtual void add(const _T &data)=0
Add an element to the datastructure.
std::function< double(const _T &, const _T &)> DistanceFunction
The definition of a distance function.
virtual bool reportsSortedResults() const =0
Return true if the solutions reported by this data structure are sorted, when calling nearestK / near...
virtual void setDistanceFunction(const DistanceFunction &distFun)
Set the distance function to use.
virtual void list(std::vector< _T > &data) const =0
Get all the elements in the datastructure.
virtual void nearestR(const _T &data, double radius, std::vector< _T > &nbh) const =0
Get the nearest neighbors of a point, within a specified radius.
DistanceFunction distFun_
The used distance function.
virtual std::size_t size() const =0
Get the number of elements in the datastructure.
const DistanceFunction & getDistanceFunction() const
Get the distance function used.
NearestNeighbors(const NearestNeighbors &)=default
virtual bool remove(const _T &data)=0
Remove an element from the datastructure.
virtual void clear()=0
Clear the datastructure.