Ponca  03745f3c84c0c8d40cec269af63efe7d3cf77f30
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 {
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 = const 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 };
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;
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
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:283
typename P::Scalar Scalar
Scalar type used for computation, as defined from template parameter P
Definition basket.h:291
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.
const std::vector< DataPoint > & PointContainer
Type used to store the external Point container in AbstractNeighborGraph::Buffers.
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.
PointContainer PointContainerConstRef
Convenience alias used to convey the constness and the absence of copy of the container.
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.
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.
@ K_MAX_NN
The maximum number of neighbors that will be visited in a range neighbors query.