Go to the documentation of this file.00001 #include <pcl/visualization/pcl_visualizer.h>
00002 #include <pcl/io/pcd_io.h>
00003
00004 using pcl::PointCloud;
00005 using pcl::PointXYZ;
00006
00007 int
00008 main (int , char **)
00009 {
00010 srand (unsigned (time (0)));
00011
00012 PointCloud<PointXYZ>::Ptr cloud (new PointCloud<PointXYZ>);
00013
00014 cloud->points.resize (5);
00015 for (size_t i = 0; i < cloud->points.size (); ++i)
00016 {
00017 cloud->points[i].x = float (i);
00018 cloud->points[i].y = float (i / 2);
00019 cloud->points[i].z = 0.0f;
00020 }
00021
00022
00023 pcl::visualization::PCLVisualizer p ("test_shapes");
00024 p.setBackgroundColor (1, 1, 1);
00025 p.addCoordinateSystem (1.0);
00026
00027
00028 p.addPolygon<PointXYZ> (cloud, 1.0, 0.0, 0.0, "polygon", 0);
00029 p.setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_LINE_WIDTH, 10, "polygon");
00030
00031 p.addLine<PointXYZ, PointXYZ> (cloud->points[0], cloud->points[1], 0.0, 1.0, 0.0);
00032 p.setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_LINE_WIDTH, 50, "line");
00033
00034 p.addSphere<PointXYZ> (cloud->points[0], 1, 0.0, 1.0, 0.0);
00035 p.setShapeRenderingProperties (pcl::visualization::PCL_VISUALIZER_LINE_WIDTH, 5, "sphere");
00036
00037
00038 p.addText ("text", 200, 200, 1.0, 0, 0, "text");
00039
00040 p.addText3D ("text3D", cloud->points[0], 1.0, 1.0, 0.0, 0.0);
00041 p.spin ();
00042 p.removeCoordinateSystem (0);
00043 p.spin ();
00044 p.addCoordinateSystem (1.0, 5, 3, 1);
00045 p.spin ();
00046 p.removeCoordinateSystem (0);
00047 p.spin ();
00048 }