src/engine/eRectangle.h

Go to the documentation of this file.
00001 /*
00002 
00003 *************************************************************************
00004 
00005 ArmageTron -- Just another Tron Lightcycle Game in 3D.
00006 Copyright (C) 2005  by Manuel Moos (z-man@users.sf.net)
00007 and the AA DevTeam (see the file AUTHORS(.txt) in the main source directory)
00008 
00009 **************************************************************************
00010 
00011 This program is free software; you can redistribute it and/or
00012 modify it under the terms of the GNU General Public License
00013 as published by the Free Software Foundation; either version 2
00014 of the License, or (at your option) any later version.
00015 
00016 This program is distributed in the hope that it will be useful,
00017 but WITHOUT ANY WARRANTY; without even the implied warranty of
00018 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019 GNU General Public License for more details.
00020 
00021 You should have received a copy of the GNU General Public License
00022 along with this program; if not, write to the Free Software
00023 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00024   
00025 ***************************************************************************
00026 
00027 */
00028 
00029 #ifndef ArmageTron_eRECTANGLE_H
00030 #define ArmageTron_eRECTANGLE_H
00031 
00032 #include "eCoord.h"
00033 
00035 class eRectangle
00036 {
00037 public:
00038     eRectangle();                                           
00039     eRectangle( eCoord const & low, eCoord const & high );  
00040 
00041     void Clear();                                  
00042     eRectangle & Include( eCoord const & point );  
00043     bool Contains( eCoord const & point ) const;   
00044     REAL Clamp( eCoord & point ) const;            
00045     REAL Clip( eCoord const & start, eCoord & stop ) const; 
00046     eCoord GetPoint( eCoord const & in ) const;    
00047 
00048 private:
00049     eCoord low_;  
00050     eCoord high_; 
00051 
00052     // accessors
00053 public:
00054     inline eCoord const & GetLow( void ) const;                 
00055     inline eRectangle const & GetLow( eCoord & low ) const;         
00056     inline eCoord const & GetHigh( void ) const;                    
00057     inline eRectangle const & GetHigh( eCoord & high ) const;   
00058 protected:
00059 private:
00060     inline eRectangle & SetLow( eCoord const & low );           
00061     inline eRectangle & SetHigh( eCoord const & high );         
00062 };
00063 
00064 // ****************************************************************************
00065 // *
00066 // *    GetLow
00067 // *
00068 // ****************************************************************************
00072 // ****************************************************************************
00073 
00074 eCoord const & eRectangle::GetLow( void ) const
00075 {
00076     return this->low_;
00077 }
00078 
00079 // ****************************************************************************
00080 // *
00081 // *    GetLow
00082 // *
00083 // ****************************************************************************
00088 // ****************************************************************************
00089 
00090 eRectangle const & eRectangle::GetLow( eCoord & low ) const
00091 {
00092     low = this->low_;
00093     return *this;
00094 }
00095 
00096 // ****************************************************************************
00097 // *
00098 // *    SetLow
00099 // *
00100 // ****************************************************************************
00105 // ****************************************************************************
00106 
00107 eRectangle & eRectangle::SetLow( eCoord const & low )
00108 {
00109     this->low_ = low;
00110     return *this;
00111 }
00112 
00113 // ****************************************************************************
00114 // *
00115 // *    GetHigh
00116 // *
00117 // ****************************************************************************
00121 // ****************************************************************************
00122 
00123 eCoord const & eRectangle::GetHigh( void ) const
00124 {
00125     return this->high_;
00126 }
00127 
00128 // ****************************************************************************
00129 // *
00130 // *    GetHigh
00131 // *
00132 // ****************************************************************************
00137 // ****************************************************************************
00138 
00139 eRectangle const & eRectangle::GetHigh( eCoord & high ) const
00140 {
00141     high = this->high_;
00142     return *this;
00143 }
00144 
00145 // ****************************************************************************
00146 // *
00147 // *    SetHigh
00148 // *
00149 // ****************************************************************************
00154 // ****************************************************************************
00155 
00156 eRectangle & eRectangle::SetHigh( eCoord const & high )
00157 {
00158     this->high_ = high;
00159     return *this;
00160 }
00161 
00162 #endif

Generated on Sat Mar 15 22:55:47 2008 for Armagetron Advanced by  doxygen 1.5.4