This is one of the most used data types, as it represents 3D xyz information only. The 3 floats are padded with an additional float for SSE alignment. The user can either access points[i].data[0] or points[i].x for accessing say, the x coordinate.
#include <pcl/point_types.h> #include <pcl/point_cloud.h> #include <pcl/io/pcd_io.h>structMyPointType{PCL_ADD_POINT4D;// preferred way of adding a XYZ+paddingfloattest;EIGEN_MAKE_ALIGNED_OPERATOR_NEW// make sure our new allocators are aligned}EIGEN_ALIGN16;// enforce SSE padding for correct memory alignmentPOINT_CLOUD_REGISTER_POINT_STRUCT(MyPointType,// here we assume a XYZ + "test" (as fields)(float,x,x)(float,y,y)(float,z,z)(float,test,test))intmain(intargc,char**argv){pcl::PointCloud<MyPointType>cloud;cloud.points.resize(2);cloud.width=2;cloud.height=1;cloud.points[0].test=1;cloud.points[1].test=2;cloud.points[0].x=cloud.points[0].y=cloud.points[0].z=0;cloud.points[1].x=cloud.points[1].y=cloud.points[1].z=3;pcl::io::savePCDFile("test.pcd",cloud);}
前两篇是在做independent study topic presentation时所学习。 现在开始进入正式学习,都是按照pcl网站上的tutorial。所以这些文章也只是笔记。Adding your own custom PointT typePointXYZ - Members: float x, y, z;This is one of the most u