visualize_polygon.hpp
Go to the documentation of this file.
00001 #ifndef VISUALIZE_POLYGON
00002 #define VISUALIZE_POLYGON
00003 #include <visualization_msgs/Marker.h>
00004 #include <geometry_msgs/Point.h>
00005 
00006 template <class PointCloudType>
00007 visualization_msgs::Marker visualize_polygon(const PointCloudType& cropping_polygon)
00008 {
00009   visualization_msgs::Marker polygon;
00010   polygon.header = cropping_polygon.header;
00011   polygon.id = 3;
00012   polygon.type = visualization_msgs::Marker::LINE_LIST;
00013   polygon.action = visualization_msgs::Marker::ADD;
00014   polygon.pose.orientation.w = 1.0;
00015   polygon.scale.x = 0.01;
00016   polygon.color.a = 0.5;
00017   polygon.color.r = 0.5;
00018   polygon.color.b = 1.0;
00019   for(unsigned int i = 0; i < cropping_polygon.size(); i++)
00020   {
00021     //Start line
00022     geometry_msgs::Point p;
00023     p.x = cropping_polygon[i].x;
00024     p.y = cropping_polygon[i].y;
00025     p.z = cropping_polygon[i].z;
00026     polygon.points.push_back(p);
00027     //End of line
00028     unsigned int j = (i+1) %cropping_polygon.size();
00029     p.x = cropping_polygon[j].x;
00030     p.y = cropping_polygon[j].y;
00031     p.z = cropping_polygon[j].z;
00032     polygon.points.push_back(p);
00033   }
00034   return polygon;
00035 }
00036 
00037 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


door_perception
Author(s): Felix Endres
autogenerated on Wed Dec 26 2012 16:03:53