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 ***************************************************************************************************/ 00035 #ifndef _TRANSFORM_WRAPPER_CPP 00036 #define _TRANSFORM_WRAPPER_CPP 00037 00038 #include <bo_polygon2d/transform_wrapper.h> 00039 00040 00041 class_transform_wrapper::class_transform_wrapper(void){is_null_transform=false;}; 00042 class_transform_wrapper::~class_transform_wrapper(void){}; 00043 00044 int class_transform_wrapper::set_transform(tf::Transform* st) 00045 { 00046 transform.setRotation(st->getRotation()); 00047 transform.setOrigin(st->getOrigin()); 00048 return 1; 00049 } 00050 00051 00052 int class_transform_wrapper::set_null_transform(void){is_null_transform=true;return 1;}; 00053 00054 00055 int class_transform_wrapper::transform_global_to_local(pcl::PointCloud<pcl::PointXYZ>* pc_global, pcl::PointCloud<pcl::PointXYZ>* pc_local) 00056 { 00057 if (!is_null_transform) 00058 { 00059 pcl_ros::transformPointCloud(*pc_global, *pc_local, transform); 00060 } 00061 else 00062 { 00063 (*pc_local)= (*pc_global); 00064 } 00065 return 1; 00066 } 00067 00068 int class_transform_wrapper::transform_local_to_global(pcl::PointCloud<pcl::PointXYZ>* pc_local, pcl::PointCloud<pcl::PointXYZ>* pc_global) 00069 { 00070 if (!is_null_transform) 00071 { 00072 pcl_ros::transformPointCloud(*pc_local, *pc_global, transform.inverse()); 00073 } 00074 else 00075 { 00076 (*pc_global)= (*pc_local); 00077 } 00078 return 1; 00079 } 00080 00081 00082 #endif 00083