9#include "kdTreeQuery.h"
10#include "../../query.h"
11#include "../Iterator/kdTreeRangeIterator.h"
22template <
typename Traits,
23 template <
typename,
typename,
typename>
typename IteratorType,
29 using DataPoint =
typename Traits::DataPoint;
30 using IndexType =
typename Traits::IndexType;
31 using Scalar =
typename DataPoint::Scalar;
32 using VectorType =
typename DataPoint::VectorType;
34 using Iterator = IteratorType<IndexType, DataPoint, KdTreeRangeQueryBase>;
45 PONCA_MULTIARCH
inline Self&
operator()(
typename QueryType::InputType input, Scalar radius)
47 return QueryType::template operator()<
Self>(input, radius);
53 return QueryType::template operator()<
Self>(input);
57 PONCA_MULTIARCH
inline Iterator
begin(){
66 PONCA_MULTIARCH
inline Iterator
end(){
71 PONCA_MULTIARCH
inline void advance(Iterator& it){
74 const auto& point = QueryType::template getInputPosition<VectorType>(points);
82 auto descentDistanceThreshold = [
this](){
return QueryType::descentDistanceThreshold();};
83 auto skipFunctor = [
this](IndexType idx){
return QueryType::skipIndexFunctor(idx);};
84 auto processNeighborFunctor = [&it](IndexType idx, IndexType i, Scalar)
91 for(IndexType i=it.m_start; i<it.m_end; ++i)
93 IndexType idx = indices[i];
94 if(skipFunctor(idx))
continue;
96 Scalar d = (point - points[idx].pos()).squaredNorm();
97 if(d < descentDistanceThreshold())
99 if( processNeighborFunctor(idx, i, d) )
return;
104 [&it](IndexType start, IndexType
end)
109 descentDistanceThreshold,
111 processNeighborFunctor))
122template <
typename Traits>
131template <
typename Traits>
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.
Input iterator to read the KdTreeRangeQueryBase object.
Extension of the Query class that allows to read the result of a range neighbors search on the KdTree...
Iterator begin()
Returns an iterator to the beginning of the Range Query.
Self & operator()(typename QueryType::InputType input, Scalar radius)
Call the range neighbors query with new input and radius parameters.
Self & operator()(typename QueryType::InputType input)
Call the range neighbors query with new input parameter.
Iterator end()
Returns an iterator to the end of the Range Query.
Customizable static base class for KdTree datastructure implementations.
Base Query class combining QueryInputIsIndex and QueryOutputIsRange.
Base Query class combining QueryInputIsPosition and QueryOutputIsRange.
This Source Code Form is subject to the terms of the Mozilla Public License, v.