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.

Definition at line 359 of file knncpp.h.

Member Typedef Documentation

◆ Matrix

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

Definition at line 361 of file knncpp.h.

◆ Matrixi

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

Definition at line 363 of file knncpp.h.

◆ Vector

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

Definition at line 362 of file knncpp.h.

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

Definition at line 381 of file knncpp.h.

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

Member Function Documentation

◆ build()

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

Definition at line 423 of file knncpp.h.

◆ 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

Definition at line 481 of file knncpp.h.

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

Definition at line 412 of file knncpp.h.

References copy.

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

Definition at line 421 of file knncpp.h.

◆ 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

Definition at line 406 of file knncpp.h.

◆ 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

Definition at line 388 of file knncpp.h.

◆ 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

Definition at line 395 of file knncpp.h.

◆ 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

Definition at line 400 of file knncpp.h.

◆ size()

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

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

Returns
number of data points

Definition at line 477 of file knncpp.h.


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