Ponca  03745f3c84c0c8d40cec269af63efe7d3cf77f30
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 "../../indexSquaredDistance.h"
10#include "../../../Common/Containers/limitedPriorityQueue.h"
11#include <cstddef>
12
13namespace Ponca
14{
15
29 template <typename Index, typename DataPoint, int MAX_KNN_SIZE>
31 {
32 public:
33 using iterator_category = std::input_iterator_tag;
34 using difference_type = std::ptrdiff_t;
35 using value_type = Index;
36 using pointer = Index*;
37 using reference = const Index&;
38
39 using Scalar = typename DataPoint::Scalar;
40 using Iterator = typename LimitedPriorityQueue<IndexSquaredDistance<Index, Scalar>, MAX_KNN_SIZE>::iterator;
41
42 PONCA_MULTIARCH inline KdTreeKNearestIterator() = default;
43 PONCA_MULTIARCH inline KdTreeKNearestIterator(const Iterator& iterator) : m_iterator(iterator) {}
44 PONCA_MULTIARCH virtual inline ~KdTreeKNearestIterator() = default;
45
46 public:
48 PONCA_MULTIARCH inline bool operator!=(const KdTreeKNearestIterator& other) const
49 {
50 return m_iterator != other.m_iterator;
51 }
52
54 PONCA_MULTIARCH inline bool operator==(const KdTreeKNearestIterator& other) const
55 {
56 return m_iterator == other.m_iterator;
57 }
58
60 PONCA_MULTIARCH inline KdTreeKNearestIterator& operator++()
61 {
62 ++m_iterator;
63 return *this;
64 }
65
67 PONCA_MULTIARCH inline KdTreeKNearestIterator operator++(int)
68 {
70 ++m_iterator;
71 return tmp;
72 }
73
75 PONCA_MULTIARCH inline void operator+=(int i) { m_iterator += i; }
76
78 PONCA_MULTIARCH inline reference operator*() const { return const_cast<reference>(m_iterator->index); }
79
80 protected:
81 Iterator m_iterator;
82 };
83} // namespace Ponca
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:283
Input iterator to read the KdTreeKNearestQueryBase object.
bool operator==(const KdTreeKNearestIterator &other) const
Equality operand.
KdTreeKNearestIterator operator++(int)
Postfix increment.
void operator+=(int i)
Value increment.
KdTreeKNearestIterator & operator++()
Prefix increment.
reference operator*() const
Dereference operator.
bool operator!=(const KdTreeKNearestIterator &other) const
Inequality operand.
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition concepts.h:11