concatenate_points.cpp
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <pcl/io/pcd_io.h>
00003 #include <pcl/point_types.h>
00004 
00005 int
00006   main (int argc, char** argv)
00007 {
00008   pcl::PointCloud<pcl::PointXYZ> cloud_a, cloud_b, cloud_c;
00009 
00010   // Fill in the cloud data
00011   cloud_a.width  = 5;
00012   cloud_b.width  = 3;
00013   cloud_a.height = cloud_b.height = 1;
00014   cloud_a.points.resize (cloud_a.width * cloud_a.height);
00015   cloud_b.points.resize (cloud_b.width * cloud_b.height);
00016 
00017   for (size_t i = 0; i < cloud_a.points.size (); ++i)
00018   {
00019     cloud_a.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
00020     cloud_a.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
00021     cloud_a.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
00022   }
00023 
00024   for (size_t i = 0; i < cloud_b.points.size (); ++i)
00025   {
00026     cloud_b.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
00027     cloud_b.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
00028     cloud_b.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
00029   }
00030 
00031   std::cerr << "Cloud A: " << std::endl;
00032   for (size_t i = 0; i < cloud_a.points.size (); ++i)
00033     std::cerr << "    " << cloud_a.points[i].x << " " << cloud_a.points[i].y << " " << cloud_a.points[i].z << std::endl;
00034 
00035   std::cerr << "Cloud B: " << std::endl;
00036   for (size_t i = 0; i < cloud_b.points.size (); ++i)
00037     std::cerr << "    " << cloud_b.points[i].x << " " << cloud_b.points[i].y << " " << cloud_b.points[i].z << std::endl;
00038 
00039   // Copy the point cloud data
00040   cloud_c  = cloud_a;
00041   cloud_c += cloud_b;
00042 
00043   std::cerr << "Cloud C: " << std::endl;
00044   for (size_t i = 0; i < cloud_c.points.size (); ++i)
00045     std::cerr << "    " << cloud_c.points[i].x << " " << cloud_c.points[i].y << " " << cloud_c.points[i].z << " " << std::endl;
00046 
00047   return (0);
00048 }


pcl
Author(s): Open Perception
autogenerated on Wed Aug 26 2015 15:22:51