3dpcp/include/slam6d/ann_kd.h
2012-09-16 14:33:11 +02:00

66 lines
1.4 KiB
C++

/** @file
* @brief Encapsules the implementation of ANN k-d trees.
* @author Ulugbek Makhmudov, Jacobs University Bremen, Bremen, Germany.
* @author Andreas Nuechter, Jacobs University Bremen, Bremen, Germany.
*/
#ifndef __ANN_KD_H__
#define __ANN_KD_H__
#include "slam6d/kdparams.h"
#include "slam6d/searchTree.h"
#include "ANN/ANN.h"
/**
* @brief Encapsulating class to create and store ANN KD Trees.
*
* A kD tree for points, with limited
* capabilities (find nearest point to
* a given point, or in a fixed radius distance).
**/
class ANNtree : public SearchTree {
public:
/**
* default constructor
*/
ANNtree();
/**
* Constructor using the point set pts and the num_of_pts n
*/
ANNtree(double **_pts, int n);
/**
* destructor
*/
virtual ~ANNtree();
/**
* Finds the closest point within the tree,
* wrt. the point given as first parameter.
* @param _p point
* @param maxdist2 maximal search distance.
* @param threadNum Thread number, for parallelization
* @return Pointer to the closest point
*/
double *FindClosest(double *_p, double maxdist2, int threadNum = 0) const;
private:
/**
* a pointer to ANNkd_tree instance
*/
ANNkd_tree* annkd;
ANNdistArray nn; //temporary ANNdistArray instance to use for storing the nearest neighbor
ANNidxArray nn_idx; //temporary ANNdistArray instance to use for storing the nearest neighbor
double** pts;
};
#endif