ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
knncpp::QueryHeap< Scalar > Class Template Reference

#include <knncpp.h>

Public Member Functions

 QueryHeap (Index *indices, Scalar *distances, const size_t maxSize)
 
void push (const Index idx, const Scalar dist)
 
void pop ()
 
Scalar front () const
 
bool full () const
 
bool empty () const
 
size_t size () const
 
void clear ()
 
void sort ()
 

Detailed Description

template<typename Scalar>
class knncpp::QueryHeap< Scalar >

Efficient heap structure to query nearest neighbours.

Constructor & Destructor Documentation

◆ QueryHeap()

template<typename Scalar >
knncpp::QueryHeap< Scalar >::QueryHeap ( Index *  indices,
Scalar *  distances,
const size_t  maxSize 
)
inline

Creates a query heap with the given index and distance memory regions.

Member Function Documentation

◆ clear()

template<typename Scalar >
void knncpp::QueryHeap< Scalar >::clear ( )
inline

Clears the query heap.

References size_.

◆ empty()

template<typename Scalar >
bool knncpp::QueryHeap< Scalar >::empty ( ) const
inline

Determines if this query heap is empty.

Returns
true if the heap contains no elements, else false

References size_.

Referenced by knncpp::QueryHeap< Scalar >::front(), and knncpp::QueryHeap< Scalar >::pop().

◆ front()

template<typename Scalar >
Scalar knncpp::QueryHeap< Scalar >::front ( ) const
inline

Returns the distance of the element in front of the heap.

References knncpp::QueryHeap< Scalar >::empty().

Referenced by knncpp::BruteForce< Scalar, Distance >::query(), and knncpp::MultiIndexHashing< Scalar >::query().

◆ full()

template<typename Scalar >
bool knncpp::QueryHeap< Scalar >::full ( ) const
inline

Determines if this query heap is full. The heap is considered full if its number of elements has reached its max size.

Returns
true if the heap is full, else false

References size_.

Referenced by knncpp::QueryHeap< Scalar >::push(), knncpp::BruteForce< Scalar, Distance >::query(), and knncpp::MultiIndexHashing< Scalar >::query().

◆ pop()

template<typename Scalar >
void knncpp::QueryHeap< Scalar >::pop ( )
inline

Removes the element at the front of the heap and restores the heap order.

References knncpp::QueryHeap< Scalar >::empty(), and size_.

Referenced by knncpp::BruteForce< Scalar, Distance >::query(), knncpp::MultiIndexHashing< Scalar >::query(), and knncpp::QueryHeap< Scalar >::sort().

◆ push()

template<typename Scalar >
void knncpp::QueryHeap< Scalar >::push ( const Index  idx,
const Scalar  dist 
)
inline

Pushes a new query data set into the heap with the given index and distance. The index identifies the point for which the given distance was computed.

Parameters
idxindex / ID of the query point
distdistance that was computed for the query point

References knncpp::QueryHeap< Scalar >::full(), and size_.

Referenced by knncpp::BruteForce< Scalar, Distance >::query(), and knncpp::MultiIndexHashing< Scalar >::query().

◆ size()

template<typename Scalar >
size_t knncpp::QueryHeap< Scalar >::size ( ) const
inline

Returns the number of elements within the query heap.

Returns
number of elements in the heap

References size_.

◆ sort()

template<typename Scalar >
void knncpp::QueryHeap< Scalar >::sort ( )
inline

The documentation for this class was generated from the following file: