diff --git a/extensions/kdtree_nanoflann.h b/extensions/kdtree_nanoflann.h index 97c882d970f6c9567097a4ad03ca260459e31ba9..a4b28cb4dd07a63c736a20827aefaf935eb622cd 100644 --- a/extensions/kdtree_nanoflann.h +++ b/extensions/kdtree_nanoflann.h @@ -25,6 +25,10 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *************************************************************************/ +/** \file kdtree_nanoflann.h */ + +#ifndef KDTREE_NANOFLANN_H +#define KDTREE_NANOFLANN_H #include @@ -47,16 +51,20 @@ typedef std::vector > my_vector_of_vectors_t; * The i'th vector represents a point in the state space. * * \tparam DIM If set to >0, it specifies a compile-time fixed dimensionality for the points in the data set, allowing more compiler optimizations. - * \tparam num_t The type of the point coordinates (typically, double or float). + * \tparam value_type The type of the point coordinates (typically, double or float). * \tparam Distance The distance metric to use: nanoflann::metric_L1, nanoflann::metric_L2, nanoflann::metric_L2_Simple, etc. - * \tparam IndexType The type for indices in the KD-tree index (typically, size_t of int) + * \tparam index_type The type for indices in the KD-tree index (typically, size_t of int) */ -template +template struct KDTreeVectorOfWorldVectorsAdaptor { - typedef KDTreeVectorOfWorldVectorsAdaptor self_t; - typedef typename Distance::template traits::distance_t metric_t; - typedef KDTreeSingleIndexAdaptor< metric_t,self_t,DIM,IndexType> index_t; + typedef KDTreeVectorOfWorldVectorsAdaptor self_t; + typedef typename Distance::template traits::distance_t metric_t; + typedef KDTreeSingleIndexAdaptor< metric_t, self_t, DIM, index_type> index_t; index_t* index; //! The kd-tree index for the user to call its methods as usual with any other FLANN index. @@ -82,9 +90,9 @@ struct KDTreeVectorOfWorldVectorsAdaptor * The user can also call index->... methods as desired. * \note nChecks_IGNORED is ignored but kept for compatibility with the original FLANN interface. */ - inline void query(const num_t *query_point, const size_t num_closest, IndexType *out_indices, num_t *out_distances_sq, const int nChecks_IGNORED = 10) const + inline void query(const value_type *query_point, const size_t num_closest, index_type *out_indices, value_type *out_distances_sq, const int nChecks_IGNORED = 10) const { - nanoflann::KNNResultSet resultSet(num_closest); + nanoflann::KNNResultSet resultSet(num_closest); resultSet.init(out_indices, out_distances_sq); index->findNeighbors(resultSet, query_point, nanoflann::SearchParams()); } @@ -105,18 +113,18 @@ struct KDTreeVectorOfWorldVectorsAdaptor } // Returns the distance between the vector "p1[0:size-1]" and the data point with index "idx_p2" stored in the class: - inline num_t kdtree_distance(const num_t *p1, const size_t idx_p2,size_t size) const + inline value_type kdtree_distance(const value_type *p1, const size_t idx_p2,size_t size) const { - num_t s=0; + value_type s=0; for (size_t i=0; i KD_ } // end namespace experimental - +#endif