3
*************************************************************************
5
ArmageTron -- Just another Tron Lightcycle Game in 3D.
6
Copyright (C) 2005 by Manuel Moos (z-man@users.sf.net)
7
and the AA DevTeam (see the file AUTHORS(.txt) in the main source directory)
9
**************************************************************************
11
This program is free software; you can redistribute it and/or
12
modify it under the terms of the GNU General Public License
13
as published by the Free Software Foundation; either version 2
14
of the License, or (at your option) any later version.
16
This program is distributed in the hope that it will be useful,
17
but WITHOUT ANY WARRANTY; without even the implied warranty of
18
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
GNU General Public License for more details.
21
You should have received a copy of the GNU General Public License
22
along with this program; if not, write to the Free Software
23
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
25
***************************************************************************
29
#ifndef ArmageTron_eRECTANGLE_H
30
#define ArmageTron_eRECTANGLE_H
34
//! the rectangle containing the arena
38
eRectangle(); //!< constructor to empty rectangle
39
eRectangle( eCoord const & low, eCoord const & high ); //!< constructor
41
void Clear(); //!< resets to empty state
42
eRectangle & Include( eCoord const & point ); //!< include the given point into the rectangle
43
bool Contains( eCoord const & point ) const; //!< checks whether the given point lies inside the rectangle
44
REAL Clamp( eCoord & point ) const; //!< clamps the point to lie inside the rectangle
45
REAL Clip( eCoord const & start, eCoord & stop ) const; //!< clips stop to lie inside the rectangle without changing the direction start->stop
46
eCoord GetPoint( eCoord const & in ) const; //!< returns a point in the interior
49
eCoord low_; //!< low corner
50
eCoord high_; //!< high corner
54
inline eCoord const & GetLow( void ) const; //!< Gets low corner
55
inline eRectangle const & GetLow( eCoord & low ) const; //!< Gets low corner
56
inline eCoord const & GetHigh( void ) const; //!< Gets high corner
57
inline eRectangle const & GetHigh( eCoord & high ) const; //!< Gets high corner
60
inline eRectangle & SetLow( eCoord const & low ); //!< Sets low corner
61
inline eRectangle & SetHigh( eCoord const & high ); //!< Sets high corner
64
// ****************************************************************************
68
// ****************************************************************************
70
//! @return low corner
72
// ****************************************************************************
74
eCoord const & eRectangle::GetLow( void ) const
79
// ****************************************************************************
83
// ****************************************************************************
85
//! @param low low corner to fill
86
//! @return A reference to this to allow chaining
88
// ****************************************************************************
90
eRectangle const & eRectangle::GetLow( eCoord & low ) const
96
// ****************************************************************************
100
// ****************************************************************************
102
//! @param low low corner to set
103
//! @return A reference to this to allow chaining
105
// ****************************************************************************
107
eRectangle & eRectangle::SetLow( eCoord const & low )
113
// ****************************************************************************
117
// ****************************************************************************
119
//! @return high corner
121
// ****************************************************************************
123
eCoord const & eRectangle::GetHigh( void ) const
128
// ****************************************************************************
132
// ****************************************************************************
134
//! @param high high corner to fill
135
//! @return A reference to this to allow chaining
137
// ****************************************************************************
139
eRectangle const & eRectangle::GetHigh( eCoord & high ) const
145
// ****************************************************************************
149
// ****************************************************************************
151
//! @param high high corner to set
152
//! @return A reference to this to allow chaining
154
// ****************************************************************************
156
eRectangle & eRectangle::SetHigh( eCoord const & high )