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>
24 class KdTreeRangeQueryBase :
public KdTreeQuery<Traits>,
public 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;
32 using QueryAccelType = KdTreeQuery<Traits>;
33 using Iterator = IteratorType<IndexType, DataPoint, KdTreeRangeQueryBase>;
34 using Self = KdTreeRangeQueryBase<Traits, IteratorType, QueryType>;
41 typename QueryType::InputType input)
42 : KdTreeQuery<Traits>(kdtree), QueryType(radius, input)
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))
106 if (KdTreeQuery<Traits>::searchInternal(
108 [&it](IndexType start, IndexType
end) {
112 descentDistanceThreshold, skipFunctor, processNeighborFunctor))
123 template <
typename Traits>
126 RangeIndexQuery<typename Traits::IndexType, typename Traits::DataPoint::Scalar>>;
133 template <
typename Traits>
136 RangePointQuery<typename Traits::IndexType, typename Traits::DataPoint>>;
const StaticKdTreeBase< Traits > * m_kdtree
[KdTreeQuery kdtree type]
void reset()
Init stack for a new search.
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.
PointContainer & points()
Get the internal point container.
const IndexContainer & samples() const
Get the internal indice container.
Scalar radius() const
Generic method to access the radius.
const InputType & input() const
This Source Code Form is subject to the terms of the Mozilla Public License, v.
KdTreeRangeQueryBase< Traits, KdTreeRangeIterator, RangeIndexQuery< typename Traits::IndexType, typename Traits::DataPoint::Scalar > > KdTreeRangeIndexQuery
Extension of the Query class that allows to read the result of a range neighbors search on the KdTree...
KdTreeRangeQueryBase< Traits, KdTreeRangeIterator, RangePointQuery< typename Traits::IndexType, typename Traits::DataPoint > > KdTreeRangePointQuery
Extension of the Query class that allows to read the result of a range neighbors search on the KdTree...