Ponca  97e1aa5c56f0b8ca113a6b95d36cc3b5cde35a4e
Point Cloud Analysis library
Loading...
Searching...
No Matches
neighborGraphTraits.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 <Eigen/Geometry>
10#include <stack>
11#include <set>
12
13#include "../../Common/Containers/hashset.h"
14#include "../../Common/Containers/stack.h"
15
16namespace Ponca
17{
18
22 template <typename _DataPoint>
24 {
34 using DataPoint = _DataPoint;
35
36 private:
37 using Scalar = typename DataPoint::Scalar;
38 using VectorType = typename DataPoint::VectorType;
39
40 public:
46 using AabbType = Eigen::AlignedBox<Scalar, DataPoint::Dim>;
47
48 // Containers
49 using IndexType = int;
51 using PointContainer = std::vector<DataPoint>;
55 using IndexContainer = std::vector<IndexType>;
58
62 using KnnGraphRangeSet = std::set<int>;
66 using KnnGraphRangeStack = std::stack<int>;
67
69 PONCA_MULTIARCH static IndexType* getIndexRawPtr(IndexContainer& idx) { return idx.data(); }
71 PONCA_MULTIARCH static const IndexType* getIndexRawPtr(const IndexContainer& idx) { return idx.data(); }
72 };
77 template <typename _DataPoint>
79 {
80 enum
81 {
82 K_MAX_NN = 1000
83 };
93 using DataPoint = _DataPoint;
94
95 private:
96 using Scalar = typename DataPoint::Scalar;
97 using VectorType = typename DataPoint::VectorType;
98
99 public:
105 using AabbType = Eigen::AlignedBox<Scalar, DataPoint::Dim>;
106
107 // Containers
108 using IndexType = int;
115 using IndexContainer = IndexType*;
118
123
125 PONCA_MULTIARCH static IndexType* getIndexRawPtr(IndexContainer& idx) { return idx; }
127 PONCA_MULTIARCH static const IndexType* getIndexRawPtr(const IndexContainer& idx) { return idx; }
128 };
129} // namespace Ponca
Stores unique signed integer values in a contiguous array.
Definition hashset.h:59
Stack with fixed-size storage.
Definition stack.h:26
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition concepts.h:11
The default traits type used by the neighbor graph.
static IndexType * getIndexRawPtr(IndexContainer &idx)
Provides access to the raw pointer where indices are stored.
std::set< int > KnnGraphRangeSet
A Set dynamic in memory, used by NeighborGraphRangeQuery.
Eigen::AlignedBox< Scalar, DataPoint::Dim > AabbType
The type used to calculate node bounding boxes.
std::stack< int > KnnGraphRangeStack
A Stack dynamic in memory, used by NeighborGraphRangeQuery.
std::vector< IndexType > IndexContainer
Type used to store the index container in the AbstractNeighborGraph::Buffers.
_DataPoint DataPoint
The type used to store point data.
std::vector< DataPoint > PointContainer
Type used to store the external Point container in AbstractNeighborGraph::Buffers.
const PointContainer & PointContainerConstRef
Convenience alias used to convey the constness and the absence of copy of the container.
IndexContainer & IndexContainerRef
Type to be used to send the index container as function parameter.
static const IndexType * getIndexRawPtr(const IndexContainer &idx)
Provides access to the raw pointer where indices are stored.
Variant to the NeighborGraphDefaultTraits that uses pointers as internal storage instead of an STL-li...
static IndexType * getIndexRawPtr(IndexContainer &idx)
Provides access to the raw pointer where indices are stored.
PointContainer PointContainerConstRef
Convenience alias used to convey the constness and the absence of copy of the container.
_DataPoint DataPoint
The type used to store point data.
Eigen::AlignedBox< Scalar, DataPoint::Dim > AabbType
The type used to calculate node bounding boxes.
DataPoint * PointContainer
Type used to store the external Point container in AbstractNeighborGraph::Buffers Non-const to allow ...
static const IndexType * getIndexRawPtr(const IndexContainer &idx)
Provides access to the raw pointer where indices are stored.
IndexType * IndexContainer
Type used to store the index container in the AbstractNeighborGraph::Buffers.
IndexContainer IndexContainerRef
Type to be used to send the index container as function parameter.
@ K_MAX_NN
The maximum number of neighbors that will be visited in a range neighbors query.