1 #include <pcl/search/brute_force.h>
 2 #include <pcl/common/common.h>
 3 #include <iostream>
 4 
 5 using namespace std;
 6 using namespace pcl;
 7 
 8 int main()
 9 {
10     pcl::PointCloud<pcl::PointXYZ>::Ptr cloud (new pcl::PointCloud<pcl::PointXYZ>);
11 
12     // x+y+z=1平面
13     for (float x = -1.0; x <= 1.0; x += 0.5)    
14     {    
15         for (float y = -1.0; y <= 1.0; y += 0.5)    
16         {    
17             pcl::PointXYZ cloud_;    
18             cloud_.x = x;    
19             cloud_.y = y;    
20             cloud_.z = 1 - x - y;    
21             cloud->push_back(cloud_);    
22         }    
23     }   
24 
25     pcl::search::BruteForce<pcl::PointXYZ> bfsearch;
26     bfsearch.setInputCloud(cloud);
27     std::vector<int> k_indices;
28     std::vector<float> k_distances;
29     pcl::PointXYZ p(-1.0,-1.0,3.0);
30     bfsearch.nearestKSearch(p,2,k_indices,k_distances);
31 
32     return 0;
33 }
View Code

相关文章:

  • 2021-08-06
  • 2021-12-17
  • 2021-12-13
  • 2021-06-24
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-11
  • 2022-12-23
  • 2022-12-23
  • 2021-10-06
  • 2021-11-20
  • 2021-04-03
  • 2021-10-15
相关资源
相似解决方案