$search
00001 /****************************************************************************** 00002 * \file 00003 * 00004 * $Id:$ 00005 * 00006 * Copyright (C) Brno University of Technology (BUT) 00007 * 00008 * This file is part of software developed by dcgm-robotics@FIT group. 00009 * 00010 * Author: Jan Gorig (xgorig01@stud.fit.vutbr.cz) 00011 * Supervised by: Michal Spanel (spanel@fit.vutbr.cz) 00012 * Date: 12/04/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 #pragma once 00029 #ifndef OBJTREE_FILTER_H 00030 #define OBJTREE_FILTER_H 00031 00032 #include <srs_env_model/but_server/objtree/box.h> 00033 00034 namespace objtree 00035 { 00036 00040 class Filter 00041 { 00042 public: 00043 enum Type 00044 { 00045 ZERO = 0, 00046 BOX = 1, 00047 PLANE = 2, 00048 SPHERE = 3 00049 }; 00050 00051 virtual bool filter(const Box &dim) const = 0; 00052 virtual Type type() const = 0; 00053 }; 00054 00058 class FilterBox : public Filter 00059 { 00060 private: 00061 Box m_box; 00062 00063 public: 00064 FilterBox(const Box &box); 00065 virtual bool filter(const Box &dim) const; 00066 00067 virtual Type type() const 00068 { 00069 return BOX; 00070 } 00071 }; 00072 00076 class FilterPlane : public Filter 00077 { 00078 private: 00079 float m_posX, m_posY, m_posZ; 00080 float m_vecX, m_vecY, m_vecZ; 00081 00082 public: 00083 FilterPlane(float posX, float posY, float posZ, float vecX, float vecY, float vecZ); 00084 virtual bool filter(const Box &dim) const; 00085 00086 virtual Type type() const 00087 { 00088 return PLANE; 00089 } 00090 }; 00091 00095 class FilterZero : public Filter 00096 { 00097 public: 00098 virtual bool filter(const Box &dim) const; 00099 00100 virtual Type type() const 00101 { 00102 return ZERO; 00103 } 00104 }; 00105 00109 class FilterSphere : public Filter 00110 { 00111 private: 00112 float m_x, m_y, m_z; 00113 float m_radiusSquare; 00114 00115 public: 00116 FilterSphere(float x, float y, float z, float radius); 00117 virtual bool filter(const Box &dim) const; 00118 00119 virtual Type type() const 00120 { 00121 return SPHERE; 00122 } 00123 }; 00124 00125 } 00126 00127 #endif // OBJTREE_FILTER_H