concatenate_fields.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;
00009   pcl::PointCloud<pcl::Normal> cloud_b;
00010   pcl::PointCloud<pcl::PointNormal> cloud_c;
00011 
00012   // Fill in the cloud data
00013   cloud_a.width  = cloud_b.width  = 5;
00014   cloud_a.height = cloud_b.height = 1;
00015   cloud_a.points.resize (cloud_a.width * cloud_a.height);
00016   cloud_b.points.resize (cloud_b.width * cloud_b.height);
00017 
00018   for (size_t i = 0; i < cloud_a.points.size (); ++i)
00019   {
00020     cloud_a.points[i].x = 1024 * rand () / (RAND_MAX + 1.0f);
00021     cloud_a.points[i].y = 1024 * rand () / (RAND_MAX + 1.0f);
00022     cloud_a.points[i].z = 1024 * rand () / (RAND_MAX + 1.0f);
00023   }
00024 
00025   for (size_t i = 0; i < cloud_b.points.size (); ++i)
00026   {
00027     cloud_b.points[i].normal[0] = 1024 * rand () / (RAND_MAX + 1.0f);
00028     cloud_b.points[i].normal[1] = 1024 * rand () / (RAND_MAX + 1.0f);
00029     cloud_b.points[i].normal[2] = 1024 * rand () / (RAND_MAX + 1.0f);
00030   }
00031 
00032   std::cerr << "Cloud A: " << std::endl;
00033   for (size_t i = 0; i < cloud_a.points.size (); ++i)
00034     std::cerr << "    " << cloud_a.points[i].x << " " << cloud_a.points[i].y << " " << cloud_a.points[i].z << std::endl;
00035 
00036   std::cerr << "Cloud B: " << std::endl;
00037   for (size_t i = 0; i < cloud_b.points.size (); ++i)
00038     std::cerr << "    " << cloud_b.points[i].normal[0] << " " << cloud_b.points[i].normal[1] << " " << cloud_b.points[i].normal[2] << std::endl;
00039 
00040   pcl::concatenateFields (cloud_a, cloud_b, cloud_c);
00041   std::cerr << "Cloud C: " << std::endl;
00042   for (size_t i = 0; i < cloud_c.points.size (); ++i)
00043     std::cerr << "    " <<
00044       cloud_c.points[i].x << " " << cloud_c.points[i].y << " " << cloud_c.points[i].z << " " <<
00045       cloud_c.points[i].normal[0] << " " << cloud_c.points[i].normal[1] << " " << cloud_c.points[i].normal[2] << std::endl;
00046 
00047   return (0);
00048 }


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