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

#include <knncpp.h>

Public Types

typedef Eigen::Matrix< Scalar, Eigen::Dynamic, Eigen::Dynamic > Matrix
 
typedef Eigen::Matrix< Scalar, Eigen::Dynamic, 1 > Vector
 
typedef knncpp::Matrixi Matrixi
 

Public Member Functions

 BruteForce ()=default
 
 BruteForce (const Matrix &data, const bool copy=false)
 
void setSorted (const bool sorted)
 
void setTakeRoot (const bool takeRoot)
 
void setThreads (const unsigned int threads)
 
void setMaxDistance (const Scalar maxDist)
 
void setData (const Matrix &data, const bool copy=false)
 
void setDistance (const Distance &distance)
 
void build ()
 
template<typename Derived >
void query (const Eigen::MatrixBase< Derived > &queryPoints, const size_t knn, Matrixi &indices, Matrix &distances) const
 
Index size () const
 
Index dimension () const
 

Detailed Description

template<typename Scalar, typename Distance = EuclideanDistance<Scalar>>
class knncpp::BruteForce< Scalar, Distance >

Class for performing brute force knn search.

Member Typedef Documentation

◆ Matrix

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
typedef Eigen::Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> knncpp::BruteForce< Scalar, Distance >::Matrix

◆ Matrixi

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
typedef knncpp::Matrixi knncpp::BruteForce< Scalar, Distance >::Matrixi

◆ Vector

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
typedef Eigen::Matrix<Scalar, Eigen::Dynamic, 1> knncpp::BruteForce< Scalar, Distance >::Vector

Constructor & Destructor Documentation

◆ BruteForce() [1/2]

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
knncpp::BruteForce< Scalar, Distance >::BruteForce ( )
default

◆ BruteForce() [2/2]

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
knncpp::BruteForce< Scalar, Distance >::BruteForce ( const Matrix &  data,
const bool  copy = false 
)
inline

Constructs a brute force instance with the given data.

Parameters
dataNxM matrix, M points of dimension N
copyif true copies the data, otherwise assumes static data

References copy, data, and knncpp::BruteForce< Scalar, Distance >::setData().

Member Function Documentation

◆ build()

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
void knncpp::BruteForce< Scalar, Distance >::build ( )
inline

◆ dimension()

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
Index knncpp::BruteForce< Scalar, Distance >::dimension ( ) const
inline

Returns the dimension of the data points in the search index.

Returns
dimension of data points

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

◆ query()

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
template<typename Derived >
void knncpp::BruteForce< Scalar, Distance >::query ( const Eigen::MatrixBase< Derived > &  queryPoints,
const size_t  knn,
Matrixi &  indices,
Matrix &  distances 
) const
inline

◆ setData()

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
void knncpp::BruteForce< Scalar, Distance >::setData ( const Matrix &  data,
const bool  copy = false 
)
inline

Set the data points used for this tree. This does not build the tree.

Parameters
dataNxM matrix, M points of dimension N
copyif true data is copied, assumes static data otherwise

References copy, and data.

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

◆ setDistance()

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
void knncpp::BruteForce< Scalar, Distance >::setDistance ( const Distance &  distance)
inline

References Utils::distance().

◆ setMaxDistance()

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
void knncpp::BruteForce< Scalar, Distance >::setMaxDistance ( const Scalar  maxDist)
inline

Set the maximum distance for querying the tree. The search will be pruned if the maximum distance is set to any positive number.

Parameters
maxDistmaximum distance, <= 0 for no limit

◆ setSorted()

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
void knncpp::BruteForce< Scalar, Distance >::setSorted ( const bool  sorted)
inline

Set if the points returned by the queries should be sorted according to their distance to the query points.

Parameters
sortedsort query results

◆ setTakeRoot()

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
void knncpp::BruteForce< Scalar, Distance >::setTakeRoot ( const bool  takeRoot)
inline

Set if the distances after the query should be rooted or not. Taking the root of the distances increases query time, but the function will return true distances instead of their powered versions.

Parameters
takeRootset true if root should be taken else false

◆ setThreads()

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
void knncpp::BruteForce< Scalar, Distance >::setThreads ( const unsigned int  threads)
inline

Set the amount of threads that should be used for querying. OpenMP has to be enabled for this to work.

Parameters
threadsamount of threads, 0 for optimal choice

◆ size()

template<typename Scalar , typename Distance = EuclideanDistance<Scalar>>
Index knncpp::BruteForce< Scalar, Distance >::size ( ) const
inline

Returns the amount of data points stored in the search index.

Returns
number of data points

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