$search
00001 /****************************************************************************** 00002 * \file 00003 * 00004 * $Id:$ 00005 * 00006 * Copyright (C) Brno University of Technology 00007 * 00008 * This file is part of software developed by dcgm-robotics@FIT group. 00009 * 00010 * Author: Vit Stancl (stancl@fit.vutbr.cz) 00011 * Supervised by: Michal Spanel (spanel@fit.vutbr.cz) 00012 * Date: dd/mm/2012 00013 * 00014 * This file is free software: you can redistribute it and/or modify 00015 * it under the terms of the GNU Lesser General Public License as published by 00016 * the Free Software Foundation, either version 3 of the License, or 00017 * (at your option) any later version. 00018 * 00019 * This file is distributed in the hope that it will be useful, 00020 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 * GNU Lesser General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public License 00025 * along with this file. If not, see <http://www.gnu.org/licenses/>. 00026 */ 00027 00028 #include <srs_env_model/but_server/plugins/octomap_plugin_tools/testing_oriented_box.h> 00029 00033 srs_env_model::CTestingOrientedBox::CTestingOrientedBox() 00034 : m_minX( 0.0 ) 00035 , m_minY( 0.0 ) 00036 , m_minZ( 0.0 ) 00037 , m_maxX( 0.0 ) 00038 , m_maxY( 0.0 ) 00039 , m_maxZ( 0.0 ) 00040 { 00041 00042 } 00043 00047 srs_env_model::CTestingOrientedBox::CTestingOrientedBox( double minx, double miny, double minz, double maxx, double maxy, double maxz ) 00048 : m_minX( minx ) 00049 , m_minY( miny ) 00050 , m_minZ( minz ) 00051 , m_maxX( maxx ) 00052 , m_maxY( maxy ) 00053 , m_maxZ( maxz ) 00054 { 00055 00056 } 00057 00061 void srs_env_model::CTestingOrientedBox::set( double minx, double miny, double minz, double maxx, double maxy, double maxz ) 00062 { 00063 m_minX = minx; m_minY = miny; m_minZ = minz; 00064 m_maxX = maxx; m_maxY = maxy; m_maxZ = maxz; 00065 } 00066 00070 void srs_env_model::CTestingOrientedBox::setCenterSize( double x, double y, double z, double sx, double sy, double sz ) 00071 { 00072 // Compute half size from sizes 00073 double shx( sx / 2 ), shy( sy / 2), shz( sz / 2 ); 00074 00075 m_minX = x - shx; m_maxX = x + shx; 00076 m_minY = y - shy; m_maxY = y + shy; 00077 m_minZ = z - shz; m_maxZ = z + shz; 00078 } 00082 bool srs_env_model::CTestingOrientedBox::isIn( double x, double y, double z ) 00083 { 00084 return ( x >= m_minX ) && ( x < m_maxX ) && ( y >= m_minY ) && ( y < m_maxY ) && ( z >= m_minZ ) && ( z < m_maxZ ); 00085 }