00001 /* 00002 CLAW - a C++ Library Absolutely Wonderful 00003 00004 CLAW is a free library without any particular aim but being useful to 00005 anyone. 00006 00007 Copyright (C) 2005-2008 Julien Jorge 00008 00009 This library is free software; you can redistribute it and/or 00010 modify it under the terms of the GNU Lesser General Public 00011 License as published by the Free Software Foundation; either 00012 version 2.1 of the License, or (at your option) any later version. 00013 00014 This library is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00017 Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public 00020 License along with this library; if not, write to the Free Software 00021 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 00022 00023 contact: julien_jorge@yahoo.fr 00024 */ 00030 #ifndef __CLAW_BOX_2D_HPP__ 00031 #define __CLAW_BOX_2D_HPP__ 00032 00033 #include <claw/coordinate_2d.hpp> 00034 00035 namespace claw 00036 { 00037 namespace math 00038 { 00039 template<class T> class rectangle; 00040 00045 template <class T> 00046 class box_2d 00047 { 00048 public: 00050 typedef T value_type; 00051 00054 typedef coordinate_2d<value_type> point_type; 00055 00057 typedef box_2d<value_type> self_type; 00058 00059 public: 00060 box_2d(); 00061 box_2d( const self_type& that ); 00062 box_2d( const rectangle<value_type>& that ); 00063 box_2d( const point_type& p1, const point_type& p2 ); 00064 box_2d( const value_type& x1, const value_type& y1, 00065 const value_type& x2, const value_type& y2 ); 00066 00067 value_type width() const; 00068 value_type height() const; 00069 00070 bool operator==(const self_type& vect) const; 00071 bool operator!=(const self_type& vect) const; 00072 self_type operator+(const point_type& vect) const; 00073 self_type operator-(const point_type& vect) const; 00074 self_type& operator+=(const point_type& vect); 00075 self_type& operator-=(const point_type& vect); 00076 00077 public: 00079 point_type first_point; 00080 00082 point_type second_point; 00083 00084 }; // class box_2d 00085 } // namespace math 00086 } // namespace claw 00087 00088 #include <claw/impl/box_2d.tpp> 00089 00090 #endif // __CLAW_BOX_2D_HPP__