Ponca  84886bac0b52a686e88046a375da13f12f2b87d2
Point Cloud Analysis library
Loading...
Searching...
No Matches
kdTreeKNearestIterator.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 <iterator>
10#include <cstddef>
11
12namespace Ponca {
13
25template <typename Index, typename DataPoint>
27{
28public:
29 using iterator_category = PONCA_MULTIARCH_CU_STD_NAMESPACE(input_iterator_tag);
30 using difference_type = std::ptrdiff_t;
31 using value_type = Index;
32 using pointer = Index*;
33 using reference = const Index&;
34
35 using Scalar = typename DataPoint::Scalar;
36 using Iterator = typename limited_priority_queue<IndexSquaredDistance<Index, Scalar>>::iterator;
37
38 inline KdTreeKNearestIterator() = default;
39 inline KdTreeKNearestIterator(const Iterator& iterator) : m_iterator(iterator) {}
40 virtual inline ~KdTreeKNearestIterator() = default;
41
42public:
44 inline bool operator !=(const KdTreeKNearestIterator& other) const {
45 return m_iterator != other.m_iterator;
46 }
47
49 inline bool operator ==(const KdTreeKNearestIterator& other) const {
50 return m_iterator == other.m_iterator;
51 }
52
54 inline KdTreeKNearestIterator& operator ++() {++m_iterator; return *this;}
55
58 KdTreeKNearestIterator tmp = *this;
59 ++m_iterator;
60 return tmp;
61 }
62
64 inline void operator +=(int i) {m_iterator += i;}
65
67 inline reference operator *() const {
68 return const_cast<reference>(m_iterator->index);
69 }
70
71protected:
72 Iterator m_iterator;
73};
74} // namespace ponca
Input iterator to read the KdTreeKNearestQueryBase object.
void operator+=(int i)
Value increment.
reference operator*() const
Dereference operator.
bool operator==(const KdTreeKNearestIterator &other) const
Equality operand.
bool operator!=(const KdTreeKNearestIterator &other) const
Inequality operand.
KdTreeKNearestIterator & operator++()
Prefix increment.
KdTreeKNearestIterator operator++(int)
Postfix increment.
The limited_priority_queue class is similar to std::priority_queue but has a limited capacity and han...
This Source Code Form is subject to the terms of the Mozilla Public License, v.