Ponca  7df32c91629c89b89840c4d7917cb272433f2d2b
Point Cloud Analysis library
Loading...
Searching...
No Matches
Ponca::StaticKnnGraphBase< Traits > Class Template Reference

Customizable base class for KnnGraph datastructure. More...

#include <knnGraph.h>

+ Inheritance diagram for Ponca::StaticKnnGraphBase< Traits >:
+ Collaboration diagram for Ponca::StaticKnnGraphBase< Traits >:

Classes

struct  Buffers
 Internal structure storing all the buffers used by the KdTree. More...
 

Public Types

using DataPoint = typename Traits::DataPoint
 DataPoint given by user via Traits

 
using Scalar = typename DataPoint::Scalar
 Scalar given by user via DataPoint

 
using VectorType = typename DataPoint::VectorType
 VectorType given by user via DataPoint

 
using IndexType = typename Traits::IndexType
 Type used to index points into the PointContainer.
 
using PointContainer = typename Traits::PointContainer
 Container for DataPoint used inside the KdTree

 
using IndexContainer = typename Traits::IndexContainer
 Container for indices used inside the KdTree

 
using KNearestIndexQuery = KnnGraphKNearestQuery< Traits >
 
using RangeIndexQuery = KnnGraphRangeQuery< Traits >
 

Public Member Functions

 StaticKnnGraphBase (Buffers &_bufs)
 Constructor that allows the use of prebuilt KnnGraph containers.
 
KNearestIndexQuery kNearestNeighbors (int index) const
 Computes a Query object to iterate over the k-nearest neighbors of a point.
 
RangeIndexQuery rangeNeighbors (int index, Scalar r) const
 Computes a Query object to iterate over the neighbors that are inside a given radius.
 
KNearestIndexQuery kNearestNeighborsIndexQuery () const
 Convenience function that provides a k-nearest neighbors Query object.
 
RangeIndexQuery rangeNeighborsIndexQuery () const
 Convenience function that provides an empty range neighbors Query object.
 
int k () const
 Number of neighbor per vertex.
 
size_t size () const
 Number of vertices in the neighborhood graph.
 
IndexType sampleCount () const
 Get the number of indices.
 
IndexType pointCount () const
 Get the number of points.
 
PointContainer points () const
 Get the internal point container.
 
IndexContainer samples () const
 Get the internal index container.
 
const Buffersbuffers () const
 Get access to the internal buffer, for instance to prepare GPU binding.
 

Protected Member Functions

const IndexTypegetIndexPtr () const
 
IndexTypegetIndexPtr ()
 
 StaticKnnGraphBase (PointContainer _points, const int _k)
 

Protected Attributes

Buffers m_bufs
 Buffers used to store the KnnGraph.
 

Friends

class KnnGraphKNearestQuery< Traits >
 This type must be equal to KnnGraphBase::KNearestIndexQuery.
 
class KnnGraphRangeQuery< Traits >
 This type must be equal to KnnGraphBase::RangeIndexQuery.
 

Detailed Description

template<typename Traits>
class Ponca::StaticKnnGraphBase< Traits >

Customizable base class for KnnGraph datastructure.

See also
Ponca::KnnGraph
Template Parameters
TraitsTraits type providing the types and constants used by the KnnGraph. Must have the same interface as the default traits type.
See also
KnnGraphDefaultTraits for the trait interface documentation.

Definition at line 48 of file knnGraph.h.

Member Typedef Documentation

◆ DataPoint

template<typename Traits >
using Ponca::StaticKnnGraphBase< Traits >::DataPoint = typename Traits::DataPoint

DataPoint given by user via Traits

Definition at line 58 of file knnGraph.h.

◆ IndexContainer

template<typename Traits >
using Ponca::StaticKnnGraphBase< Traits >::IndexContainer = typename Traits::IndexContainer

Container for indices used inside the KdTree

Definition at line 58 of file knnGraph.h.

◆ IndexType

template<typename Traits >
using Ponca::StaticKnnGraphBase< Traits >::IndexType = typename Traits::IndexType

Type used to index points into the PointContainer.

Definition at line 58 of file knnGraph.h.

◆ KNearestIndexQuery

Definition at line 60 of file knnGraph.h.

◆ PointContainer

template<typename Traits >
using Ponca::StaticKnnGraphBase< Traits >::PointContainer = typename Traits::PointContainer

Container for DataPoint used inside the KdTree

Definition at line 58 of file knnGraph.h.

◆ RangeIndexQuery

Definition at line 61 of file knnGraph.h.

◆ Scalar

template<typename Traits >
using Ponca::StaticKnnGraphBase< Traits >::Scalar = typename DataPoint::Scalar

Scalar given by user via DataPoint

Definition at line 58 of file knnGraph.h.

◆ VectorType

template<typename Traits >
using Ponca::StaticKnnGraphBase< Traits >::VectorType = typename DataPoint::VectorType

VectorType given by user via DataPoint

Definition at line 58 of file knnGraph.h.

Constructor & Destructor Documentation

◆ StaticKnnGraphBase() [1/2]

template<typename Traits >
Ponca::StaticKnnGraphBase< Traits >::StaticKnnGraphBase ( PointContainer  _points,
const int  _k 
)
inlineprotected

Definition at line 93 of file knnGraph.h.

◆ StaticKnnGraphBase() [2/2]

template<typename Traits >
Ponca::StaticKnnGraphBase< Traits >::StaticKnnGraphBase ( Buffers _bufs)
inline

Constructor that allows the use of prebuilt KnnGraph containers.

Each internal values of a KnnGraph can be extracted using `KnnGraphbuffers()`

Note
This constructor can be used to avoid the convertion and building process, which is useful to transfer directly the KnnGraph to the device in CUDA.
Parameters
_bufsInternal buffers of the KnnGraph

Definition at line 105 of file knnGraph.h.

Member Function Documentation

◆ buffers()

template<typename Traits >
const Buffers & Ponca::StaticKnnGraphBase< Traits >::buffers ( ) const
inline

Get access to the internal buffer, for instance to prepare GPU binding.

Definition at line 182 of file knnGraph.h.

◆ getIndexPtr() [1/2]

template<typename Traits >
IndexType * Ponca::StaticKnnGraphBase< Traits >::getIndexPtr ( )
inlineprotected

Definition at line 69 of file knnGraph.h.

◆ getIndexPtr() [2/2]

template<typename Traits >
const IndexType * Ponca::StaticKnnGraphBase< Traits >::getIndexPtr ( ) const
inlineprotected

Definition at line 68 of file knnGraph.h.

◆ k()

template<typename Traits >
int Ponca::StaticKnnGraphBase< Traits >::k ( ) const
inline

Number of neighbor per vertex.

Definition at line 167 of file knnGraph.h.

◆ kNearestNeighbors()

template<typename Traits >
KNearestIndexQuery Ponca::StaticKnnGraphBase< Traits >::kNearestNeighbors ( int  index) const
inline

Computes a Query object to iterate over the k-nearest neighbors of a point.

As k was set during the construction of the KnnGraphBase, it doesn't need to be provided.

The returned object can be reset and reused with the () operator, to compute a new result (also takes an index as parameter).

Parameters
indexIndex of the point that the query evaluates
Returns
The KNearestIndexQuery mutable object to iterate over the search results.

Definition at line 118 of file knnGraph.h.

◆ kNearestNeighborsIndexQuery()

template<typename Traits >
KNearestIndexQuery Ponca::StaticKnnGraphBase< Traits >::kNearestNeighborsIndexQuery ( ) const
inline

Convenience function that provides a k-nearest neighbors Query object.

Same as KnnGraphBase::kNearestNeighbors (0).

Warning
Unlike KdTreeBase::kNearestNeighborsIndexQuery, this function doesn't really return an empty query. This is due to the fact that the KnnGraphBase::kNearestNeighbors query can't set the k value to zero, as it is a value that is managed by the KnnGraphBase structure. Therefore, this function returns the k-nearest neighbors query made with the evaluation point set to 0.
Returns
The KNearestIndexQuery mutable object that can be called with the operator () with an index as argument, to fetch the k-nearest neighbors of a point.
See also
kNearestNeighbors

Definition at line 148 of file knnGraph.h.

◆ pointCount()

template<typename Traits >
IndexType Ponca::StaticKnnGraphBase< Traits >::pointCount ( ) const
inline

Get the number of points.

Definition at line 176 of file knnGraph.h.

◆ points()

template<typename Traits >
PointContainer Ponca::StaticKnnGraphBase< Traits >::points ( ) const
inline

Get the internal point container.

Definition at line 178 of file knnGraph.h.

◆ rangeNeighbors()

template<typename Traits >
RangeIndexQuery Ponca::StaticKnnGraphBase< Traits >::rangeNeighbors ( int  index,
Scalar  r 
) const
inline

Computes a Query object to iterate over the neighbors that are inside a given radius.

The returned object can be reset and reused with the () operator, to compute a new result (also takes an index and a radius as parameters).

Parameters
indexIndex of the point that the query evaluates
rRadius around where to search the neighbors
Returns
The RangeIndexQuery mutable object to iterate over the search results.

Definition at line 131 of file knnGraph.h.

◆ rangeNeighborsIndexQuery()

template<typename Traits >
RangeIndexQuery Ponca::StaticKnnGraphBase< Traits >::rangeNeighborsIndexQuery ( ) const
inline

Convenience function that provides an empty range neighbors Query object.

The returned object can be called with the arguments (i, r) to fetch the neighbors that are in range r of the point of index i.

Same as KnnGraphBase::rangeNeighbors (0, 0).

Returns
The empty KNearestIndexQuery mutable object to iterate over the search results.
See also
rangeNeighbors

Definition at line 162 of file knnGraph.h.

◆ sampleCount()

template<typename Traits >
IndexType Ponca::StaticKnnGraphBase< Traits >::sampleCount ( ) const
inline

Get the number of indices.

Definition at line 174 of file knnGraph.h.

◆ samples()

template<typename Traits >
IndexContainer Ponca::StaticKnnGraphBase< Traits >::samples ( ) const
inline

Get the internal index container.

Definition at line 180 of file knnGraph.h.

◆ size()

template<typename Traits >
size_t Ponca::StaticKnnGraphBase< Traits >::size ( ) const
inline

Number of vertices in the neighborhood graph.

Definition at line 169 of file knnGraph.h.

Friends And Related Symbol Documentation

◆ KnnGraphKNearestQuery< Traits >

This type must be equal to KnnGraphBase::KNearestIndexQuery.

See also
KnnGraphKNearestQuery

Definition at line 1 of file knnGraph.h.

◆ KnnGraphRangeQuery< Traits >

This type must be equal to KnnGraphBase::RangeIndexQuery.

See also
KnnGraphRangeQuery

Definition at line 1 of file knnGraph.h.

Member Data Documentation

◆ m_bufs

template<typename Traits >
Buffers Ponca::StaticKnnGraphBase< Traits >::m_bufs
protected

Buffers used to store the KnnGraph.

Definition at line 186 of file knnGraph.h.