test_shapes.cpp
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 argc, char **argv)
00009 {
00010   srand (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 = i; 
00018     cloud->points[i].y = i / 2; 
00019     cloud->points[i].z = 0;
00020   }
00021 
00022   // Start the visualizer
00023   pcl::visualization::PCLVisualizer p ("test_shapes");
00024   p.setBackgroundColor (1, 1, 1);
00025   p.addCoordinateSystem (0.1);
00026 
00027   //p.addPolygon (cloud, "polygon");
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 //  p.removePolygon ("poly");
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 }


pcl
Author(s): Open Perception
autogenerated on Mon Oct 6 2014 03:18:32