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_PLANE_H 00030 #define OBJTREE_PLANE_H 00031 00032 #include <srs_env_model/but_server/objtree/object.h> 00033 #include <srs_env_model/but_server/objtree/box.h> 00034 #include <srs_env_model/but_server/objtree/types.h> 00035 00036 namespace objtree 00037 { 00038 00043 class Plane : public Object 00044 { 00045 private: 00046 Point m_pos; 00047 Vector m_normal; 00048 Polygon m_points; 00049 float m_d; 00050 Point m_boundingMin, m_boundingMax; 00051 00052 public: 00053 Plane(const Point ¢er, const Vector &normal, const Point &scale); 00054 Plane(const Polygon &points); 00055 00056 virtual bool fitsIntoBox(const Box &box) const; 00057 virtual bool interfereWithBox(const Box &box) const; 00058 virtual bool isSimilar(const Object *object) const; 00059 virtual bool isPointInside(float x, float y, float z) const; 00060 00061 const Point& pos() const { return m_pos; } 00062 const Vector& normal() const { return m_normal; } 00063 const Polygon& points() const { return m_points; } 00064 const Point& boundingMin() const { return m_boundingMin; } 00065 const Point& boundingMax() const { return m_boundingMax; } 00066 00067 #if HISTORY_ENABLED 00068 00069 virtual void updateHistory() { m_history->update(m_pos); } 00070 #endif 00071 }; 00072 00073 } 00074 00075 #endif // OBJTREE_PLANE_H