9#include "kdTreeQuery.h"
10#include "../../query.h"
11#include "../Iterator/kdTreeKNearestIterator.h"
22template <
typename Traits,
23 template <
typename,
typename>
typename IteratorType,
28 using DataPoint =
typename Traits::DataPoint;
29 using IndexType =
typename Traits::IndexType;
30 using Scalar =
typename DataPoint::Scalar;
31 using VectorType =
typename DataPoint::VectorType;
33 using Iterator = IteratorType<typename Traits::IndexType, typename Traits::DataPoint>;
40 PONCA_MULTIARCH
inline Self&
operator()(
typename QueryType::InputType input, IndexType k)
42 return QueryType::template operator()<
Self>(input, k);
47 return QueryType::template operator()<
Self>(input);
51 PONCA_MULTIARCH
inline Iterator
begin(){
55 return Iterator(QueryType::m_queue.
begin());
59 PONCA_MULTIARCH
inline Iterator
end(){
60 return Iterator(QueryType::m_queue.
end());
64 PONCA_MULTIARCH
inline void search(){
66 [](IndexType, IndexType){},
67 [
this](){
return QueryType::descentDistanceThreshold();},
68 [
this](IndexType idx){
return QueryType::skipIndexFunctor(idx);},
69 [
this](IndexType idx, IndexType, Scalar d){QueryType::m_queue.push({idx, d});
return false;}
79template <
typename Traits>
88template <
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.
Query object that provides a method to search neighbors on the KdTree depending on a distance thresho...
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.
Base Query class combining QueryInputIsIndex and QueryOutputIsKNearest.
Base Query class combining QueryInputIsPosition and QueryOutputIsKNearest.
This Source Code Form is subject to the terms of the Mozilla Public License, v.