9#include "kdTreeQuery.h"
10#include "../../query.h"
11#include "../Iterator/kdTreeRangeIterator.h"
15template <
typename Traits,
16 template <
typename,
typename,
typename>
typename IteratorType,
22 using DataPoint =
typename Traits::DataPoint;
23 using IndexType =
typename Traits::IndexType;
24 using Scalar =
typename DataPoint::Scalar;
25 using VectorType =
typename DataPoint::VectorType;
27 using Iterator = IteratorType<IndexType, DataPoint, KdTreeRangeQueryBase>;
37 inline Iterator begin(){
44 inline Iterator end(){
49 inline void advance(Iterator& it){
52 const auto& point = QueryType::getInputPosition(points);
54 if (points.empty() || indices.empty())
60 auto descentDistanceThreshold = [
this](){
return QueryType::descentDistanceThreshold();};
61 auto skipFunctor = [
this](IndexType idx){
return QueryType::skipIndexFunctor(idx);};
62 auto processNeighborFunctor = [&it](IndexType idx, IndexType i, Scalar)
69 for(IndexType i=it.m_start; i<it.m_end; ++i)
71 IndexType idx = indices[i];
72 if(skipFunctor(idx))
continue;
74 Scalar d = (point - points[idx].pos()).squaredNorm();
75 if(d < descentDistanceThreshold())
77 if( processNeighborFunctor(idx, i, d) )
return;
82 [&it](IndexType start, IndexType end)
87 descentDistanceThreshold,
89 processNeighborFunctor))
90 it.m_index =
static_cast<IndexType
>(points.size());
94template <
typename Traits>
97template <
typename Traits>
[KdTreeSparse type definition]
void reset()
Init stack for a new search.
const KdTreeBase< Traits > * m_kdtree
[KdTreeQuery kdtree type]
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.