Ponca  292d8d7132745e0d4242ff9a01e93697fc96b204
Point Cloud Analysis library
Loading...
Searching...
No Matches
neighborGraphOneConnectedQuery.h
1/*
2 This Source Code Form is subject to the terms of the Mozilla Public
3 License, v. 2.0. If a copy of the MPL was not distributed with this
4 file, You can obtain one at http://mozilla.org/MPL/2.0/.
5*/
6
7#pragma once
8
9#include "../../query.h"
10#include "../Iterator/neighborGraphOneConnectedIterator.h"
11
12namespace Ponca
13{
16 {
17 using OutputParameter = typename QueryOutputBase::DummyOutputParameter;
18 };
19
28 template <typename _NeighborGraph>
29 class NeighborGraphOneConnectedQuery
30 : public Query<QueryInputIsIndex<typename _NeighborGraph::Traits::IndexType>, NeighborGraphQueryOutputType>
31 {
32 public:
33 using NeighborGraph = _NeighborGraph;
34 using Traits = typename NeighborGraph::Traits;
35 using Iterator =
38
39 using Self = NeighborGraphOneConnectedQuery<NeighborGraph>;
40
41 public:
42 PONCA_MULTIARCH inline NeighborGraphOneConnectedQuery(const NeighborGraph* graph, int index)
43 : QueryType(index), m_graph(graph)
44 {
45 }
47 PONCA_MULTIARCH inline Self& operator()(int index) { return QueryType::template operator()<Self>(index); }
48
50 PONCA_MULTIARCH [[nodiscard]] inline Iterator begin() const
51 {
52 return Iterator(m_graph->getIndexPtr()) + m_graph->beginId(QueryType::input());
53 }
54
56 PONCA_MULTIARCH [[nodiscard]] inline Iterator end() const
57 {
58 return Iterator(m_graph->getIndexPtr()) + m_graph->endId(QueryType::input());
59 }
60
61 protected:
62 const NeighborGraph* m_graph{nullptr};
63 };
64
65} // namespace Ponca
Base iterator class for NeighborGraphOneConnectedQuery.
Iterator end() const
Returns an iterator to the end of the k-nearest neighbors query.
Self & operator()(int index)
Call the k-nearest neighbors query with new input parameter.
Iterator begin() const
Returns an iterator to the beginning of the k-nearest neighbors query.
const InputType & input() const
Definition query.h:65
Base class for queries output types.
Definition query.h:40
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition concepts.h:11
NeighborGraphBase< NeighborGraphDefaultTraits< DataPoint > > NeighborGraph
Public interface for the NeighborGraph datastructure.
Output type of the NeighborGraphOneConnectedQuery.