Ponca  7d8ac87a7de01d881c9fde3c42e397b44bffb901
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{
13
25 template <typename Index, typename DataPoint>
27 {
28 public:
29 using iterator_category = std::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 PONCA_MULTIARCH inline KdTreeKNearestIterator() = default;
39 PONCA_MULTIARCH inline KdTreeKNearestIterator(const Iterator& iterator) : m_iterator(iterator) {}
40 PONCA_MULTIARCH virtual inline ~KdTreeKNearestIterator() = default;
41
42 public:
44 PONCA_MULTIARCH inline bool operator!=(const KdTreeKNearestIterator& other) const
45 {
46 return m_iterator != other.m_iterator;
47 }
48
50 PONCA_MULTIARCH inline bool operator==(const KdTreeKNearestIterator& other) const
51 {
52 return m_iterator == other.m_iterator;
53 }
54
56 PONCA_MULTIARCH inline KdTreeKNearestIterator& operator++()
57 {
58 ++m_iterator;
59 return *this;
60 }
61
63 PONCA_MULTIARCH inline KdTreeKNearestIterator operator++(int)
64 {
66 ++m_iterator;
67 return tmp;
68 }
69
71 PONCA_MULTIARCH inline void operator+=(int i) { m_iterator += i; }
72
74 PONCA_MULTIARCH inline reference operator*() const { return const_cast<reference>(m_iterator->index); }
75
76 protected:
77 Iterator m_iterator;
78 };
79} // namespace Ponca
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:318
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.
This Source Code Form is subject to the terms of the Mozilla Public License, v.