00001 /************************************************************************************************** 00002 Software License Agreement (BSD License) 00003 00004 Copyright (c) 2011-2013, LAR toolkit developers - University of Aveiro - http://lars.mec.ua.pt 00005 All rights reserved. 00006 00007 Redistribution and use in source and binary forms, with or without modification, are permitted 00008 provided that the following conditions are met: 00009 00010 *Redistributions of source code must retain the above copyright notice, this list of 00011 conditions and the following disclaimer. 00012 *Redistributions in binary form must reproduce the above copyright notice, this list of 00013 conditions and the following disclaimer in the documentation and/or other materials provided 00014 with the distribution. 00015 *Neither the name of the University of Aveiro nor the names of its contributors may be used to 00016 endorse or promote products derived from this software without specific prior written permission. 00017 00018 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 00019 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 00020 FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 00021 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00022 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 00023 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00024 IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 00025 OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 ***************************************************************************************************/ 00036 #ifndef _polygon_primitive_CPP_ 00037 #define _polygon_primitive_CPP_ 00038 00039 00040 #include "polygon_primitive.h" 00041 00051 c_polygon_primitive::c_polygon_primitive(ros::NodeHandle *node, const char* name, unsigned char r, unsigned char g, unsigned char b) 00052 { 00053 00054 rosnode = node; 00055 grow_number = 0; 00056 allocate_space(); 00057 set_names(name); 00058 00059 //Set the name of the local reference system 00060 std::string tmp_str(data.misc.name); 00061 std::string tmp_str1("/"); 00062 data.frames.local_name = tmp_str1 + tmp_str; 00063 00064 data.misc.color.r = r; 00065 data.misc.color.g = g; 00066 data.misc.color.b = b; 00067 00068 //set default values for area and solidity 00069 data.hulls.convex.area = NAN; 00070 data.hulls.convex.solidity = NAN; 00071 data.hulls.concave.area = NAN; 00072 data.hulls.concave.solidity = NAN; 00073 00074 //ROS_INFO("Starting a new polygon class named %s",data.misc.name); 00075 }; 00076 00080 c_polygon_primitive::~c_polygon_primitive() 00081 { 00082 //reset all shared ptr to free 00083 pointclouds.all.reset(); 00084 pointclouds.projected.reset(); 00085 pointclouds.additional.reset(); 00086 data.hulls.convex.polygon.reset(); 00087 data.hulls.convex.extended_polygon.reset(); 00088 data.hulls.concave.polygon.reset(); 00089 data.hulls.concave.extended_polygon.reset(); 00090 pointclouds.growed.reset(); 00091 pointclouds.tmp.reset(); 00092 data.planes.current.reset();; 00093 data.planes.previous.reset();; 00094 }; 00095 00096 00097 #endif 00098