$search
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 argc, char **argv) 00009 { 00010 srand (time (0)); 00011 00012 PointCloud<PointXYZ> cloud; 00013 00014 cloud.points.resize (5); 00015 for (size_t i = 0; i < cloud.points.size (); ++i) 00016 { 00017 cloud.points[i].x = i; cloud.points[i].y = i / 2; cloud.points[i].z = 0; 00018 } 00019 00020 // Start the visualizer 00021 pcl_visualization::PCLVisualizer p ("test_shapes"); 00022 p.setBackgroundColor (1, 1, 1); 00023 p.addCoordinateSystem (0.1); 00024 00025 //p.addPolygon (cloud, "polygon"); 00026 p.addPolygon (cloud, 1.0, 0.0, 0.0, "polygon", 0); 00027 p.setShapeRenderingProperties (pcl_visualization::PCL_VISUALIZER_LINE_WIDTH, 10, "polygon"); 00028 00029 p.addLine<PointXYZ, PointXYZ> (cloud.points[0], cloud.points[1], 0.0, 1.0, 0.0); 00030 p.setShapeRenderingProperties (pcl_visualization::PCL_VISUALIZER_LINE_WIDTH, 50, "line"); 00031 00032 p.addSphere<PointXYZ> (cloud.points[0], 1, 0.0, 1.0, 0.0); 00033 p.setShapeRenderingProperties (pcl_visualization::PCL_VISUALIZER_LINE_WIDTH, 5, "sphere"); 00034 // p.removePolygon ("poly"); 00035 00036 p.spin (); 00037 }