9#include "kdTreeQuery.h"
10#include "../../query.h"
11#include "../Iterator/kdTreeRangeIterator.h"
23 template <
typename Traits,
template <
typename,
typename,
typename>
typename IteratorType,
typename QueryType>
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<IndexType, DataPoint, KdTreeRangeQueryBase>;
41 typename QueryType::InputType input)
47 PONCA_MULTIARCH
inline Self&
operator()(
typename QueryType::InputType input, Scalar radius)
49 return QueryType::template operator()<
Self>(input, radius);
55 return QueryType::template operator()<
Self>(input);
59 PONCA_MULTIARCH
inline Iterator
begin()
72 PONCA_MULTIARCH
inline void advance(Iterator& it)
76 const auto& point = QueryType::template getInputPosition<VectorType>(points);
84 auto descentDistanceThreshold = [
this]() {
return QueryType::descentDistanceThreshold(); };
85 auto skipFunctor = [
this](IndexType idx) {
return QueryType::skipIndexFunctor(idx); };
86 auto processNeighborFunctor = [&it](IndexType idx, IndexType i, Scalar) {
92 for (IndexType i = it.m_start; i < it.m_end; ++i)
94 IndexType idx = indices[i];
98 Scalar d = (point - points[idx].pos()).squaredNorm();
99 if (d < descentDistanceThreshold())
101 if (processNeighborFunctor(idx, i, d))
108 [&it](IndexType start, IndexType
end) {
112 descentDistanceThreshold, skipFunctor, processNeighborFunctor))
123 template <
typename Traits>
133 template <
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.
IndexType pointCount() const
Get the number of points.
PointContainer & points()
Get the internal point container.
const IndexContainer & samples() const
Get the internal indice container.
Composes the Query object depending on an input type and output type.
This Source Code Form is subject to the terms of the Mozilla Public License, v.