9#include "kdTreeQuery.h"
10#include "../../query.h"
11#include "../Iterator/kdTreeKNearestIterator.h"
23 template <
typename Traits,
template <
typename,
typename,
int>
typename IteratorType,
typename QueryType>
24 class KdTreeKNearestQueryBase :
public KdTreeQuery<Traits>,
public QueryType
27 using DataPoint =
typename Traits::DataPoint;
28 using IndexType =
typename Traits::IndexType;
29 using Scalar =
typename DataPoint::Scalar;
30 using VectorType =
typename DataPoint::VectorType;
31 using QueryAccelType = KdTreeQuery<Traits>;
32 using Iterator = IteratorType<typename Traits::IndexType, typename Traits::DataPoint, Traits::MAX_KNN_SIZE>;
33 using Self = KdTreeKNearestQueryBase<Traits, IteratorType, QueryType>;
36 typename QueryType::InputType input)
37 : KdTreeQuery<Traits>(kdtree), QueryType(k, input)
42 PONCA_MULTIARCH
inline Self&
operator()(
typename QueryType::InputType
input, IndexType k)
44 return QueryType::template operator()<Self>(
input, k);
49 return QueryType::template operator()<Self>(
input);
53 PONCA_MULTIARCH
inline Iterator
begin()
58 return Iterator(QueryType::m_queue.
begin());
62 PONCA_MULTIARCH
inline Iterator
end() {
return Iterator(QueryType::m_queue.
end()); }
65 PONCA_MULTIARCH
inline void search()
69 [](IndexType, IndexType) {}, [
this]() {
return QueryType::descentDistanceThreshold(); },
70 [
this](IndexType idx) {
return QueryType::skipIndexFunctor(idx); },
71 [
this](IndexType idx, IndexType, Scalar d) {
72 QueryType::m_queue.push({idx, d});
83 template <
typename Traits>
86 KNearestIndexQuery<typename Traits::IndexType, typename Traits::DataPoint::Scalar, Traits::MAX_KNN_SIZE>>;
93 template <
typename Traits>
Input iterator to read the KdTreeKNearestQueryBase object.
Extension of the Query class that allows to read the result of a k-nearest neighbors search on the Kd...
Self & operator()(typename QueryType::InputType input, IndexType k)
Call the k-nearest neighbors query with new input and neighbor number parameters.
Self & operator()(typename QueryType::InputType input)
Call the k-nearest neighbors query with new input parameter.
Iterator end()
Returns an iterator to the end of the k-nearest neighbors query.
Iterator begin()
Returns an iterator to the beginning of the k-nearest neighbors query.
const StaticKdTreeBase< Traits > * m_kdtree
[KdTreeQuery kdtree type]
void reset()
Init stack for a new search.
bool searchInternal(const VectorType &point, LeafPreparationFunctor prepareLeafTraversal, DescentDistanceThresholdFunctor descentDistanceThreshold, SkipIndexFunctor skipFunctor, ProcessNeighborFunctor processNeighborFunctor)
Search internally the neighbors of a point using the kdtree.
Customizable static base class for KdTree datastructure implementations.
const InputType & input() const
Query< QueryInputIsPosition< DataPoint >, QueryOutputIsKNearest< Index, typename DataPoint::Scalar, MAX_KNN_SIZE > > KNearestPointQuery
Base Query alias combining QueryInputIsIndex and QueryOutputIs#OUT_TYPE##.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
KdTreeKNearestQueryBase< Traits, KdTreeKNearestIterator, KNearestPointQuery< typename Traits::IndexType, typename Traits::DataPoint, Traits::MAX_KNN_SIZE > > KdTreeKNearestPointQuery
Extension of the Query class that allows to read the result of a k-nearest neighbors search on the Kd...
KdTreeKNearestQueryBase< Traits, KdTreeKNearestIterator, KNearestIndexQuery< typename Traits::IndexType, typename Traits::DataPoint::Scalar, Traits::MAX_KNN_SIZE > > KdTreeKNearestIndexQuery
Extension of the Query class that allows to read the result of a k-nearest neighbors search on the Kd...