9#include "../../query.h"
10#include "../Iterator/neighborGraphRangeIterator.h"
53 template <
typename _NeighborGraph>
55 typename _NeighborGraph::Traits::DataPoint::Scalar>
59 using NeighborGraph = _NeighborGraph;
62 using DataPoint =
typename Traits::DataPoint;
63 using IndexType =
typename Traits::IndexType;
64 using Scalar =
typename DataPoint::Scalar;
65 using VectorType =
typename DataPoint::VectorType;
82 return QueryType::template operator()<
Self>(index, radius);
86 PONCA_MULTIARCH
inline Self&
operator()(
int index) {
return QueryType::template operator()<
Self>(index); }
99 PONCA_MULTIARCH
inline Iterator end() {
return Iterator(
this,
static_cast<int>(m_graph->pointCount())); }
102 PONCA_MULTIARCH
inline void initialize(Iterator& iterator)
105 m_flag.insert(QueryType::input());
107 PONCA_DEBUG_ASSERT(
m_stack.empty());
108 m_stack.push(QueryType::input());
110 iterator.m_index = -1;
120 const auto& points = m_graph->points();
121 const auto& point = points[QueryType::input()].pos();
123 if (iterator ==
end())
129 int idx_current =
m_stack.top();
132 PONCA_DEBUG_ASSERT((point - points[idx_current].pos()).squaredNorm() < QueryType::squaredRadius());
134 iterator.m_index = idx_current;
136 for (
int idx_nei : m_graph->oneConnectedNeighbors(idx_current))
138 PONCA_DEBUG_ASSERT(idx_nei >= 0);
141 Scalar d = (point - points[idx_nei].pos()).squaredNorm();
142 Scalar th = QueryType::descentDistanceThreshold();
147 auto [iteratorToInsertedValue, wasInserted] =
m_flag.insert(idx_nei);
151 PONCA_ASSERT(iteratorToInsertedValue !=
m_flag.end());
159 if (iterator.m_index != QueryType::input())
167 typename Traits::KnnGraphRangeSet
m_flag;
_Traits Traits
Alias to the Traits type
Input iterator to read the NeighborGraphRangeQuery object.
Extension of the Query class that allows to read the result of a range neighbor search on the KnnGrap...
void advance(Iterator &iterator)
Helper function for the NeighborGraphRangeIterator that advances the range neighbors search using the...
Iterator begin()
Returns an iterator to the beginning of the range neighbors query.
Self & operator()(int index)
Call the range neighbors query with new input parameter.
Traits::KnnGraphRangeStack m_stack
Holds the next ids the Query should visit.
Traits::KnnGraphRangeSet m_flag
Stores every visited neighbor ids.
Self & operator()(int index, Scalar radius)
Call the range neighbors query with new input and radius parameters.
Iterator end()
Returns an iterator to the end of the range neighbors query.
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.