Ponca  7df32c91629c89b89840c4d7917cb272433f2d2b
Point Cloud Analysis library
Loading...
Searching...
No Matches
knnGraphTraits.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>&;
53 using IndexContainer = std::vector<IndexType>;
56
60 using KnnGraphRangeSet = std::set<int>;
64 using KnnGraphRangeStack = std::stack<int>;
65
67 PONCA_MULTIARCH static IndexType* getIndexRawPtr(IndexContainer& idx) { return idx.data(); }
69 PONCA_MULTIARCH static const IndexType* getIndexRawPtr(const IndexContainer& idx) { return idx.data(); }
70 };
75 template <typename _DataPoint>
77 {
78 enum
79 {
80 K_MAX_NN = 1000
81 };
92
93 private:
94 using Scalar = typename DataPoint::Scalar;
95 using VectorType = typename DataPoint::VectorType;
96
97 public:
103 using AabbType = Eigen::AlignedBox<Scalar, DataPoint::Dim>;
104
105 // Containers
106 using IndexType = int;
114
119
121 PONCA_MULTIARCH static IndexType* getIndexRawPtr(IndexContainer& idx) { return idx; }
123 PONCA_MULTIARCH static const IndexType* getIndexRawPtr(const IndexContainer& idx) { return idx; }
124 };
125} // namespace Ponca
Aggregator class used to declare specialized structures using CRTP.
Definition basket.h:257
typename P::Scalar Scalar
Scalar type used for computation, as defined from template parameter P
Definition basket.h:265
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Definition bitset.h:17
The default traits type used by the kd-tree.
static IndexType * getIndexRawPtr(IndexContainer &idx)
Provides access to the raw pointer where indices are stored.
const std::vector< DataPoint > & PointContainer
Type used to store the external Point container in the KnnGraph::Buffer.
std::vector< IndexType > IndexContainer
Type used to store the index container in the KnnGraph::Buffer.
std::set< int > KnnGraphRangeSet
A Set dynamic in memory, used by KnnGraphRangeQuery.
static const IndexType * getIndexRawPtr(const IndexContainer &idx)
Provides access to the raw pointer where indices are stored.
std::stack< int > KnnGraphRangeStack
A Stack dynamic in memory, used by KnnGraphRangeQuery.
IndexContainer & IndexContainerRef
Type to be used to send the index container as function parameter.
Eigen::AlignedBox< Scalar, DataPoint::Dim > AabbType
The type used to calculate node bounding boxes.
Variant to the KnnGraph Traits type that uses pointers as internal storage instead of an STL-like con...
@ K_MAX_NN
The maximum number of neighbors that will be visited in a range neighbors query.
Eigen::AlignedBox< Scalar, DataPoint::Dim > AabbType
The type used to calculate node bounding boxes.
static const IndexType * getIndexRawPtr(const IndexContainer &idx)
Provides access to the raw pointer where indices are stored.
static IndexType * getIndexRawPtr(IndexContainer &idx)
Provides access to the raw pointer where indices are stored.
IndexType * IndexContainer
Type used to store the index container in the KnnGraph::Buffer.