13 #include <pcl/io/pcd_io.h>
14 #include <pcl/point_types.h>
19 pcl::PointCloud< pcl::PointXYZ > cloud;
24 cloud.is_dense =
false;
25 cloud.points.resize(cloud.width * cloud.height);
27 for(
size_t i = 0; i < cloud.points.size(); ++i)
29 cloud.points[i].x = 1024 * rand() / (RAND_MAX + 1.0f);
30 cloud.points[i].y = 1024 * rand() / (RAND_MAX + 1.0f);
31 cloud.points[i].z = 1024 * rand() / (RAND_MAX + 1.0f);
34 pcl::io::savePCDFileASCII(
"test_pcd.pcd", cloud);
35 std::cerr <<
"Saved " << cloud.points.size()
36 <<
" data points to test_pcd.pcd." << std::endl;
38 for(
size_t i = 0; i < cloud.points.size(); ++i)
39 std::cerr <<
" " << cloud.points[i].x <<
" " << cloud.points[i].y <<
" "
40 << cloud.points[i].z << std::endl;