Ponca  93eea5457c48839cb5d16642765afa89fc7cfe66
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 <cstddef>
10
11namespace Ponca {
12
24template <typename Index, typename DataPoint>
26{
27public:
28 using iterator_category = std::input_iterator_tag;
29 using difference_type = std::ptrdiff_t;
30 using value_type = Index;
31 using pointer = Index*;
32 using reference = const Index&;
33
34 using Scalar = typename DataPoint::Scalar;
35 using Iterator = typename limited_priority_queue<IndexSquaredDistance<Index, Scalar>>::iterator;
36
37 PONCA_MULTIARCH inline KdTreeKNearestIterator() = default;
38 PONCA_MULTIARCH inline KdTreeKNearestIterator(const Iterator& iterator) : m_iterator(iterator) {}
39 PONCA_MULTIARCH virtual inline ~KdTreeKNearestIterator() = default;
40
41public:
43 PONCA_MULTIARCH inline bool operator !=(const KdTreeKNearestIterator& other) const {
44 return m_iterator != other.m_iterator;
45 }
46
48 PONCA_MULTIARCH inline bool operator ==(const KdTreeKNearestIterator& other) const {
49 return m_iterator == other.m_iterator;
50 }
51
53 PONCA_MULTIARCH inline KdTreeKNearestIterator& operator ++() {++m_iterator; return *this;}
54
56 PONCA_MULTIARCH inline KdTreeKNearestIterator operator++(int) {
57 KdTreeKNearestIterator tmp = *this;
58 ++m_iterator;
59 return tmp;
60 }
61
63 PONCA_MULTIARCH inline void operator +=(int i) {m_iterator += i;}
64
66 PONCA_MULTIARCH inline reference operator *() const {
67 return const_cast<reference>(m_iterator->index);
68 }
69
70protected:
71 Iterator m_iterator;
72};
73} // 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.