Public Member Functions

knn_cloud Class Reference

#include <knn_cloud.h>

List of all members.

Public Member Functions

 knn_cloud (const double epsilon=0.01)
 ~knn_cloud ()
void refresh (const std::vector< vector3 > &points)
double nearest_distance (const vector3 &p) const
size_t knn_search (size_t k, const vector3 &p, std::vector< size_t > &indices, std::vector< double > &distances) const
bool is_valid () const
vector3 operator[] (const size_t idx) const
size_t size () const

Detailed Description

A basic wrapper for 3D points around the ANN library for nearest neighbour search.


Constructor & Destructor Documentation

knn_cloud::knn_cloud ( const double  epsilon = 0.01  )  [inline]
Parameters:
[in] epsilon The accepted error in the nearest neighbor search. See the ANN documentation more details.
knn_cloud::~knn_cloud (  )  [inline]

Member Function Documentation

bool knn_cloud::is_valid (  )  const [inline]
Returns:
TRUE if the KD-tree has been populated; FALSE otherwise.
size_t knn_cloud::knn_search ( size_t  k,
const vector3 p,
std::vector< size_t > &  indices,
std::vector< double > &  distances 
) const [inline]

Find K nearest neighbors in the database.

Parameters:
[in] k The number of neighbors to be found.
[in] p The query point.
[out] indices The indices of the found neighbors. These are correspond to the data that was given when the database was created.
[out] distances The distances to the neighbors.
Returns:
The number of found points. This can be lower than k if the databse is small.
double knn_cloud::nearest_distance ( const vector3 p  )  const [inline]

Find the distance to the closest point in the database.

Parameters:
[in] p The query point.
Returns:
The distance to the point in the database that is closest to the input.
vector3 knn_cloud::operator[] ( const size_t  idx  )  const [inline]

Index into the database.

Parameters:
[in] idx The point index. This corresponds to the indices used when the database was created.
Returns:
The point at the requested place in the database.
void knn_cloud::refresh ( const std::vector< vector3 > &  points  )  [inline]

Populate the data structure with data points.

Parameters:
[in] points A list of 3D points to be inserted in the KD-tree.
size_t knn_cloud::size (  )  const [inline]
Returns:
Number of points in the database.

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