#include #include #include #include #include #include #include #include #define TRY_PCL_OCTREE #ifdef TRY_PCL_OCTREE #include typedef pcl::search::Octree PCL_OT; //#include //typedef pcl::octree::OctreePointCloudSearch PCL_OT; #else #include typedef pcl::KdTreeFLANN PCL_OT; #endif typedef PCLPointCloudObject PCL_PC; GUI gui; PointCloudObject obj(500*1000,1,false); Scene scene; OctreeObject ot(-500,-500,-500,1000,1000,1000); void init(){ ot.setRenderPoints(true); GRandClip r(0,100,Range64f(-500,500)); DataSegment ps = obj.selectXYZ(); DataSegment cs = obj.selectRGBA32f(); std::vector > nn(1000),nnres(1000); for(int i=0;i(r,r,r); } } Time t = Time::now(); for(int i=0;i p = ps[i]; ot.insert(FixedColVector(p[0],p[1],p[2],1)); } t.showAge("insertion time"); std::vector > q = ot.query(0,-500,-500,500,1000,1000); static PointCloudObject res(q.size(),1,false); ps = res.selectXYZ(); cs = res.selectRGBA32f(); for(size_t i=0;i pcl_ps = pcl_pc.selectXYZ(); for(int i=0;i > ptr(&pcl_pc.pcl()); t = Time::now(); pcl_ot.setInputCloud(ptr); t.showAge("set input cloud to pcl tree"); // 3 times faster! t = Time::now(); for(size_t i=0;i dstIdx; std::vector dstDist; pcl_ot.nearestKSearch(pcl::PointXYZ(nn[i][0],nn[i][1],nn[i][2]), 1, dstIdx,dstDist); } t.showAge("pcl nn search"); t = Time::now(); for(size_t i=0;i