Ponca  292d8d7132745e0d4242ff9a01e93697fc96b204
Point Cloud Analysis library
Loading...
Searching...
No Matches
Ponca::NeighborGraphRangeQuery< _NeighborGraph > Class Template Reference

Extension of the Query class that allows to read the result of a range neighbor search on the KnnGraph. More...

#include <neighborGraphRangeQuery.h>

Inheritance diagram for Ponca::NeighborGraphRangeQuery< _NeighborGraph >:
Collaboration diagram for Ponca::NeighborGraphRangeQuery< _NeighborGraph >:

Public Types

using NeighborGraph = _NeighborGraph
using Traits = typename NeighborGraph::Traits
using QueryType = RangeIndexQuery<typename Traits::IndexType, typename Traits::DataPoint::Scalar>
using DataPoint = typename Traits::DataPoint
using IndexType = typename Traits::IndexType
using Scalar = typename DataPoint::Scalar
using VectorType = typename DataPoint::VectorType
using Iterator = NeighborGraphRangeIterator<NeighborGraph>
using Self = NeighborGraphRangeQuery<NeighborGraph>
Public Types inherited from Ponca::Query< QueryInputIsIndex< Index >, QueryOutputIsRange< Index, Scalar > >
using QueryInType
 Alias to the input type.
using QueryOutType
 Alias to the output type.
Public Types inherited from Ponca::QueryInputIsIndex< Index >
using Base = QueryInput<Index>
 Alias to the inherited type.
using InputType = typename Base::InputType
 Alias to the templated input type (Index).
Public Types inherited from Ponca::QueryInput< Index >
using InputType
 Alias to the templated input type.
Public Types inherited from Ponca::QueryOutputIsRange< Index, Scalar >
using OutputParameter = Scalar
 Alias to Output type.

Public Member Functions

 NeighborGraphRangeQuery (const NeighborGraph *graph, Scalar radius, int index)
Self & operator() (int index, Scalar radius)
 Call the range neighbors query with new input and radius parameters.
Self & operator() (int index)
 Call the range neighbors query with new input parameter.
Iterator begin ()
 Returns an iterator to the beginning of the range neighbors query.
Iterator end ()
 Returns an iterator to the end of the range neighbors query.
Public Member Functions inherited from Ponca::Query< QueryInputIsIndex< Index >, QueryOutputIsRange< Index, Scalar > >
 Query (const typename QueryInType::InputType &in)
 Default constructor that initialize the input parameter only.
 Query (const typename QueryOutType::OutputParameter &outParam, const typename QueryInType::InputType &in)
 Default constructor that initialize the input and output parameters.
Base & operator() (const typename QueryInType::InputType &in, outputType &&... out)
 Access operator that resets the input and output parameters.
Base & operator() (const typename QueryInType::InputType &in)
 Access operator that resets the input parameter only.
Public Member Functions inherited from Ponca::QueryInputIsIndex< Index >
 QueryInputIsIndex (const InputType &point=-1)
 Default constructor that initialize the input index.
void operator() (const InputType &point=InputType::Zero())
 Access operator that resets the input index.
Public Member Functions inherited from Ponca::QueryInput< Index >
 QueryInput (InputType input)
 Default constructor that initialize the input field.
const InputType & input () const
 Read access to the input.
Public Member Functions inherited from Ponca::QueryOutputIsRange< Index, Scalar >
 QueryOutputIsRange (OutputParameter radius=OutputParameter(0))
 Default constructor that initialize the output parameter value.
void operator() (OutputParameter radius)
 Access operator that resets the output parameter.
Scalar radius () const
 Generic method to access the radius.
Scalar squaredRadius () const
 Generic method to access the radius squared.
void setRadius (Scalar radius)
 Set the radius distance of the query.
void setSquaredRadius (Scalar radius)
 Set the squared radius distance of the query.

Protected Member Functions

void initialize (Iterator &iterator)
void advance (Iterator &iterator)
 Helper function for the NeighborGraphRangeIterator that advances the range neighbors search using the k-nearest neighbors known by the NeighborGraphBase.
Protected Member Functions inherited from Ponca::QueryInputIsIndex< Index >
template<typename IndexType>
bool skipIndexFunctor (IndexType idx) const
 Functor used to check if a given Idx must be skipped.
template<typename VectorType, typename Container>
const VectorType getInputPosition (const Container &c)
 Generic method to access input position. The VectorType needs to be passed as a template argument.
Protected Member Functions inherited from Ponca::QueryInput< Index >
void setInput (const InputType &input)
 Edit the input.
Protected Member Functions inherited from Ponca::QueryOutputIsRange< Index, Scalar >
void reset ()
 Reset Query for a new search.
Scalar descentDistanceThreshold () const
 Distance threshold used during tree descent to select nodes to explore.

Protected Attributes

const NeighborGraph * m_graph {nullptr}
Traits::KnnGraphRangeSet m_flag
 Stores every visited neighbor ids.
Traits::KnnGraphRangeStack m_stack
 Holds the next ids the Query should visit.
Protected Attributes inherited from Ponca::QueryOutputIsRange< Index, Scalar >
Scalar m_squared_radius {0}
 Radius used for the search.

Friends

class NeighborGraphRangeIterator< NeighborGraph >

Detailed Description

template<typename _NeighborGraph>
class Ponca::NeighborGraphRangeQuery< _NeighborGraph >

Extension of the Query class that allows to read the result of a range neighbor search on the KnnGraph.

Output result of a KnnGraph::rangeNeighbors query request.

See also
StaticKnnGraphBase

Contrary to the KdTreeRangeQuery this RangeIndexQuery needs to keep track of all the already visited neighbors using a Set, and to record the next neighbors to explore during the search using a Stack.

Traits::KnnGraphRangeSet A set of indices that is used to avoid the already visited neighbor in our search algorithm. Can either be :

  • Traits::KnnGraphRangeSet = std::set<int> for dynamic memory, which is not compatible with CUDA. (Used by NeighborGraphDefaultTraits)

-Traits::KnnGraphRangeSet = HashSet<K_MAX_NN> : Stores the index in a HashMap-like structure. The Best case complexity for insertion and search is O(1) and worst case is O(N), depending on the given dataset and on the chosen hashing function (Sparser hashing results will lead to a reduce look-up time). (Used by NeighborGraphPointerTraits)

See also
HashSet
  • Traits::KnnGraphRangeSet = BitSet<MAX_POINT_CLOUD_SIZE> : Stores the index in a set of bits by allocating a single bit to each possible indices. This structure provides better search and insert complexity at the cost of more memory use (trivial insertion and search, with O(1) complexity). Since we need to allocate a single memory bit for each possible indices, to indicate if the index was stored or not, the memory use of this BitSet type is dependant of the total size of the point cloud. Extensively big point clouds can therefore provoke memory allocation problems if we have a memory limit (e.g. if we are instantiating the NeighborGraphRangeQuery inside local memory, in a CUDA kernel).
    See also
    BitSet for more detailed information about the memory usage.
    Traits::KnnGraphRangeStack The stack type storing the next neighbor to visit. Can either be :
  • Traits::KnnGraphRangeStack = std::set<int> A stack that dynamically allocates memory (Used by NeighborGraphDefaultTraits)
  • Traits::KnnGraphRangeStack = Stack<int, K_MAX_NN> : Has a limited amount of storage. Will throw out of bound exception in debug mode if elements are inserted above the maximum capacity of the stack. (Used by NeighborGraphPointerTraits)

Definition at line 54 of file neighborGraphRangeQuery.h.

Member Typedef Documentation

◆ DataPoint

template<typename _NeighborGraph>
using Ponca::NeighborGraphRangeQuery< _NeighborGraph >::DataPoint = typename Traits::DataPoint

Definition at line 62 of file neighborGraphRangeQuery.h.

◆ IndexType

template<typename _NeighborGraph>
using Ponca::NeighborGraphRangeQuery< _NeighborGraph >::IndexType = typename Traits::IndexType

Definition at line 63 of file neighborGraphRangeQuery.h.

◆ Iterator

template<typename _NeighborGraph>
using Ponca::NeighborGraphRangeQuery< _NeighborGraph >::Iterator = NeighborGraphRangeIterator<NeighborGraph>

Definition at line 66 of file neighborGraphRangeQuery.h.

◆ NeighborGraph

template<typename _NeighborGraph>
using Ponca::NeighborGraphRangeQuery< _NeighborGraph >::NeighborGraph = _NeighborGraph

Definition at line 59 of file neighborGraphRangeQuery.h.

◆ QueryType

template<typename _NeighborGraph>
using Ponca::NeighborGraphRangeQuery< _NeighborGraph >::QueryType = RangeIndexQuery<typename Traits::IndexType, typename Traits::DataPoint::Scalar>

Definition at line 61 of file neighborGraphRangeQuery.h.

◆ Scalar

template<typename _NeighborGraph>
using Ponca::NeighborGraphRangeQuery< _NeighborGraph >::Scalar = typename DataPoint::Scalar

Definition at line 64 of file neighborGraphRangeQuery.h.

◆ Self

template<typename _NeighborGraph>
using Ponca::NeighborGraphRangeQuery< _NeighborGraph >::Self = NeighborGraphRangeQuery<NeighborGraph>

Definition at line 67 of file neighborGraphRangeQuery.h.

◆ Traits

template<typename _NeighborGraph>
using Ponca::NeighborGraphRangeQuery< _NeighborGraph >::Traits = typename NeighborGraph::Traits

Definition at line 60 of file neighborGraphRangeQuery.h.

◆ VectorType

template<typename _NeighborGraph>
using Ponca::NeighborGraphRangeQuery< _NeighborGraph >::VectorType = typename DataPoint::VectorType

Definition at line 65 of file neighborGraphRangeQuery.h.

Constructor & Destructor Documentation

◆ NeighborGraphRangeQuery()

template<typename _NeighborGraph>
Ponca::NeighborGraphRangeQuery< _NeighborGraph >::NeighborGraphRangeQuery ( const NeighborGraph * graph,
Scalar radius,
int index )
inline

Definition at line 74 of file neighborGraphRangeQuery.h.

Member Function Documentation

◆ advance()

template<typename _NeighborGraph>
void Ponca::NeighborGraphRangeQuery< _NeighborGraph >::advance ( Iterator & iterator)
inlineprotected

Helper function for the NeighborGraphRangeIterator that advances the range neighbors search using the k-nearest neighbors known by the NeighborGraphBase.

Parameters
iteratorThe NeighborGraphRangeIterator from where the advance request is made

Definition at line 118 of file neighborGraphRangeQuery.h.

◆ begin()

template<typename _NeighborGraph>
Iterator Ponca::NeighborGraphRangeQuery< _NeighborGraph >::begin ( )
inline

Returns an iterator to the beginning of the range neighbors query.

Definition at line 89 of file neighborGraphRangeQuery.h.

◆ end()

template<typename _NeighborGraph>
Iterator Ponca::NeighborGraphRangeQuery< _NeighborGraph >::end ( )
inline

Returns an iterator to the end of the range neighbors query.

Definition at line 99 of file neighborGraphRangeQuery.h.

◆ initialize()

template<typename _NeighborGraph>
void Ponca::NeighborGraphRangeQuery< _NeighborGraph >::initialize ( Iterator & iterator)
inlineprotected

Definition at line 102 of file neighborGraphRangeQuery.h.

◆ operator()() [1/2]

template<typename _NeighborGraph>
Self & Ponca::NeighborGraphRangeQuery< _NeighborGraph >::operator() ( int index)
inline

Call the range neighbors query with new input parameter.

Definition at line 86 of file neighborGraphRangeQuery.h.

◆ operator()() [2/2]

template<typename _NeighborGraph>
Self & Ponca::NeighborGraphRangeQuery< _NeighborGraph >::operator() ( int index,
Scalar radius )
inline

Call the range neighbors query with new input and radius parameters.

Definition at line 80 of file neighborGraphRangeQuery.h.

◆ NeighborGraphRangeIterator< NeighborGraph >

template<typename _NeighborGraph>
friend class NeighborGraphRangeIterator< NeighborGraph >
friend

Definition at line 1 of file neighborGraphRangeQuery.h.

Member Data Documentation

◆ m_flag

template<typename _NeighborGraph>
Traits::KnnGraphRangeSet Ponca::NeighborGraphRangeQuery< _NeighborGraph >::m_flag
protected

Stores every visited neighbor ids.

Definition at line 167 of file neighborGraphRangeQuery.h.

◆ m_graph

template<typename _NeighborGraph>
const NeighborGraph* Ponca::NeighborGraphRangeQuery< _NeighborGraph >::m_graph {nullptr}
protected

Definition at line 166 of file neighborGraphRangeQuery.h.

◆ m_stack

template<typename _NeighborGraph>
Traits::KnnGraphRangeStack Ponca::NeighborGraphRangeQuery< _NeighborGraph >::m_stack
protected

Holds the next ids the Query should visit.

Definition at line 168 of file neighborGraphRangeQuery.h.