$search
00001 /* 00002 * Copyright (C) 2008 00003 * Robert Bosch LLC 00004 * Research and Technology Center North America 00005 * Palo Alto, California 00006 * 00007 * All rights reserved. 00008 * 00009 *------------------------------------------------------------------------------ 00010 * project ....: PUMA: Probablistic Unsupervised Model Acquisition 00011 * file .......: Point3DKdTree.h 00012 * authors ....: Benjamin Pitzer 00013 * organization: Robert Bosch LLC 00014 * creation ...: 10/29/2008 00015 * modified ...: $Date:2008-03-03 10:26:02 -0800 (Mon, 03 Mar 2008) $ 00016 * changed by .: $Author:benjaminpitzer $ 00017 * revision ...: $Revision:141 $ 00018 */ 00019 #ifndef POINT3DKDTREE_H_ 00020 #define POINT3DKDTREE_H_ 00021 00022 //== INCLUDES ================================================================== 00023 #include "ANN/ANN.h" 00024 #include "rtc/rtcVec3.h" 00025 00026 //== NAMESPACES ================================================================ 00027 namespace rtc { 00028 00029 //== FORWARD DECLARATIONS ====================================================== 00030 00031 //== CLASS DEFINITION ========================================================== 00032 class Point3DKdTree 00033 { 00034 public: 00035 Point3DKdTree(float* x, float* y, float* z, int num_points); 00036 virtual ~Point3DKdTree(); 00037 // find closest point in kd-tree, returns index to this point 00038 int findNearest(const Vec3f& p); 00039 int findNearest(float x, float y, float z); 00040 // find closest k points in kd-tree 00041 void findNearest(float x, float y, float z, int k, int* points); 00042 void findNearest(float x, float y, float z, int k, std::vector<int>& points); 00043 void findNearest(const Vec3f& p, int k, int* points); 00044 void findNearest(const Vec3f& p, int k, std::vector<int>& points); 00045 00046 // find all points within range 00047 int findWithinRange(float x, float y, float z, float range, std::vector<int>& points); 00048 int findWithinRange(const Vec3f& p, float range, std::vector<int>& points); 00049 protected: 00050 // internal search method 00051 void findNearest(float* ann_sample, ANNidx* i, ANNdist* d); 00052 // KD-Tree data 00053 ANNkd_tree *ann_tree; 00054 ANNpointArray dataPts; 00055 }; 00056 00057 //============================================================================== 00058 } // NAMESPACE puma 00059 //============================================================================== 00060 #endif // POINT2DKDTREE_H_ defined 00061 //==============================================================================