9#include "abstractNeighborGraph.h"
10#include "Query/neighborGraphOneConnectedQuery.h"
11#include "Query/neighborGraphRangeQuery.h"
13#include "../KdTree/kdTree.h"
24 template <
typename _Traits>
27 WRITE_NEIGHBOR_GRAPH_ALIASES
36 typename Traits::IndexContainerRef
_ranges)
52 template <
typename _Traits>
55 NeighborGraphOneConnectedQuery<StaticNeighborGraphBase<_Traits>>,
56 NeighborGraphRangeQuery<StaticNeighborGraphBase<_Traits>>>
59 WRITE_NEIGHBOR_GRAPH_ALIASES
69 using Buffers =
typename Base::Buffers;
83 template <
typename _Traits>
87 WRITE_NEIGHBOR_GRAPH_ALIASES
91 using Buffers =
typename Base::Buffers;
105 template <
typename KdTreeTraits>
109 Base::m_bufs.points_size =
_kdtree.pointCount();
110#define CHECK_TRAITS_TYPENAME_COMPAT(A, B) \
111 static_assert(std::is_same_v<A, B> || std::is_convertible_v<A, B> || std::is_convertible_v<B, A>, \
112 "KdTreeTraits::DataPoint is not equal to Traits::DataPoint");
114 static_assert(std::is_same_v<typename Traits::DataPoint, typename KdTreeTraits::DataPoint>,
115 "KdTreeTraits::DataPoint is not equal to Traits::DataPoint");
117 CHECK_TRAITS_TYPENAME_COMPAT(
typename Traits::PointContainer,
typename KdTreeTraits::PointContainer)
118 CHECK_TRAITS_TYPENAME_COMPAT(
typename Traits::IndexContainer,
typename KdTreeTraits::IndexContainer)
120#undef CHECK_TRAITS_TYPENAME_COMPAT
131 Base::m_bufs.ranges.resize(
cloudSize + 1);
132 Base::m_bufs.ranges[0] = 0;
136 for (
auto n :
_kdtree.rangeNeighbors(
typename KdTreeTraits::IndexType(
i),
range))
138 Base::m_bufs.indices.push_back(n);
140 Base::m_bufs.ranges[
i + 1] = Base::m_bufs.indices.size();
142 Base::m_bufs.indices_size = Base::m_bufs.indices.size();
154 template <
typename DataPo
int>
Base class for neighbor graphs.
PointContainer points() const
Get the internal point container.
Aggregator class used to declare specialized structures using CRTP.
NeighborGraphBase(const KdTreeBase< KdTreeTraits > &_kdtree, const Scalar range)
Build a neighbor graph by connecting all points using Euclidean range queries: two points.
typename DataPoint::Scalar Scalar
Scalar given by user via DataPoint
Extension of the Query class that allows to read the neighbors that are directly connected to the que...
Extension of the Query class that allows to read the result of a range neighbor search on the KnnGrap...
Static generic neighbor graph (does not include build functions)
typename Traits::PointContainer PointContainer
Container for DataPoint used inside the KdTree
int endId(int vId) const
Index of the end of the neighborhood range (see storing convention in NeighborGraphBuffer)
_Traits Traits
Alias to the Traits type
int beginId(int vId) const
Index of the beginning of the neighborhood range (see storing convention in NeighborGraphBuffer)
int k(int vId=0) const
[Neighbor Graph Accessors]
This Source Code Form is subject to the terms of the Mozilla Public License, v.
Internal structure storing the buffers used by a neighbor graph.
Buffer class for StaticNeighborGraphBase.
typename Traits::IndexContainer IndexContainer
Container for indices used inside the KdTree
typename Traits::PointContainerConstRef PointContainerConstRef
Container for DataPoint used inside the KdTree