#include <eRectangle.h>
Public Member Functions | |
eRectangle () | |
constructor to empty rectangle | |
eRectangle (eCoord const &low, eCoord const &high) | |
constructor | |
void | Clear () |
resets to empty state | |
eRectangle & | Include (eCoord const &point) |
include the given point into the rectangle | |
bool | Contains (eCoord const &point) const |
checks whether the given point lies inside the rectangle | |
REAL | Clamp (eCoord &point) const |
clamps the point to lie inside the rectangle | |
REAL | Clip (eCoord const &start, eCoord &stop) const |
clips stop to lie inside the rectangle without changing the direction start->stop | |
eCoord | GetPoint (eCoord const &in) const |
returns a point in the interior | |
eCoord const & | GetLow (void) const |
Gets low corner. | |
eRectangle const & | GetLow (eCoord &low) const |
Gets low corner. | |
eCoord const & | GetHigh (void) const |
Gets high corner. | |
eRectangle const & | GetHigh (eCoord &high) const |
Gets high corner. | |
Private Member Functions | |
eRectangle & | SetLow (eCoord const &low) |
Sets low corner. | |
eRectangle & | SetHigh (eCoord const &high) |
Sets high corner. | |
Private Attributes | |
eCoord | low_ |
low corner | |
eCoord | high_ |
high corner |
Definition at line 35 of file eRectangle.h.
eRectangle::eRectangle | ( | void | ) |
eRectangle::eRectangle | ( | eCoord const & | low, | |
eCoord const & | high | |||
) |
constructor
low | lowest part of the coordinates of the rectangle | |
high | highest part of the coordinates of the rectangle |
Definition at line 57 of file eRectangle.cpp.
void eRectangle::Clear | ( | void | ) |
resets to empty state
Definition at line 71 of file eRectangle.cpp.
References eCoord, high_, and low_.
Referenced by eWallRim::UpdateBounds().
eRectangle & eRectangle::Include | ( | eCoord const & | point | ) |
include the given point into the rectangle
point | the point to include |
Definition at line 88 of file eRectangle.cpp.
Referenced by finite_xy_plane(), and eWallRim::UpdateBounds().
00089 { 00090 if (low_.x > point.x) 00091 low_.x = point.x; 00092 if (low_.y > point.y) 00093 low_.y = point.y; 00094 if (high_.x < point.x) 00095 high_.x = point.x; 00096 if (high_.y < point.y) 00097 high_.y = point.y; 00098 00099 return *this; 00100 }
bool eRectangle::Contains | ( | eCoord const & | point | ) | const |
checks whether the given point lies inside the rectangle
point | the point to test |
Definition at line 113 of file eRectangle.cpp.
Referenced by eWallRim::IsBound().
00114 { 00115 return low_.x <= point.x && low_.y <= point.y && 00116 high_.x >= point.x && high_.y >= point.y; 00117 }
REAL eRectangle::Clamp | ( | eCoord & | point | ) | const |
clamps the point to lie inside the rectangle
point | the point to clamp |
Definition at line 140 of file eRectangle.cpp.
References high_, low_, REAL, and se_Clamp().
Referenced by eWallRim::Bound().
00141 { 00142 REAL ret = -1E+30; 00143 se_Clamp( point.x, low_.x, -1, ret); 00144 se_Clamp( point.y, low_.y, -1, ret); 00145 se_Clamp( point.x, high_.x, 1, ret); 00146 se_Clamp( point.y, high_.y, 1, ret); 00147 00148 return ret; 00149 }
REAL eRectangle::Clip | ( | eCoord const & | start, | |
eCoord & | stop | |||
) | const |
clips stop to lie inside the rectangle without changing the direction start->stop
start | point (asserted to lie inside the rectangle) to serve as starting point | |
stop | point to clip |
Definition at line 187 of file eRectangle.cpp.
References eCoord, high_, low_, REAL, and se_Clip().
Referenced by eWallRim::Clip().
00188 { 00189 // clip in x-direction 00190 REAL rx = se_Clip( start, stop, low_, eCoord(-1,0) ); 00191 if ( rx >= 1 ) 00192 { 00193 rx = se_Clip( start, stop, high_, eCoord(1,0) ); 00194 } 00195 00196 // clip in y-direction 00197 REAL ry = se_Clip( start, stop, low_, eCoord(0,-1) ); 00198 if ( ry >= 1 ) 00199 { 00200 ry = se_Clip( start, stop, high_, eCoord(0,1) ); 00201 } 00202 00203 return rx * ry; 00204 }
eCoord eRectangle::GetPoint | ( | eCoord const & | in | ) | const |
returns a point in the interior
in | coordinates in the range of 0..1 of the point to get |
Definition at line 217 of file eRectangle.cpp.
References eCoord, high_, and low_.
Referenced by gArena::GetRandomPos().
00218 { 00219 eCoord diff = high_ - low_; 00220 return low_ + eCoord( diff.x * in.x, diff.y * in.y ); 00221 }
eCoord const & eRectangle::GetLow | ( | void | ) | const [inline] |
Gets low corner.
Definition at line 74 of file eRectangle.h.
References low_.
Referenced by cWidget::Map::DrawMap(), cWidget::Map::DrawRimWalls(), finite_xy_plane(), and se_OffsetBounds().
00075 { 00076 return this->low_; 00077 }
eRectangle const & eRectangle::GetLow | ( | eCoord & | low | ) | const [inline] |
Gets low corner.
low | low corner to fill |
Definition at line 90 of file eRectangle.h.
References low_.
00091 { 00092 low = this->low_; 00093 return *this; 00094 }
eCoord const & eRectangle::GetHigh | ( | void | ) | const [inline] |
Gets high corner.
Definition at line 123 of file eRectangle.h.
References high_.
Referenced by cWidget::Map::DrawMap(), cWidget::Map::DrawRimWalls(), finite_xy_plane(), and se_OffsetBounds().
00124 { 00125 return this->high_; 00126 }
eRectangle const & eRectangle::GetHigh | ( | eCoord & | high | ) | const [inline] |
Gets high corner.
high | high corner to fill |
Definition at line 139 of file eRectangle.h.
References high_.
00140 { 00141 high = this->high_; 00142 return *this; 00143 }
eRectangle & eRectangle::SetLow | ( | eCoord const & | low | ) | [inline, private] |
Sets low corner.
low | low corner to set |
Definition at line 107 of file eRectangle.h.
References low_.
00108 { 00109 this->low_ = low; 00110 return *this; 00111 }
eRectangle & eRectangle::SetHigh | ( | eCoord const & | high | ) | [inline, private] |
Sets high corner.
high | high corner to set |
Definition at line 156 of file eRectangle.h.
References high_.
00157 { 00158 this->high_ = high; 00159 return *this; 00160 }
eCoord eRectangle::low_ [private] |
low corner
Definition at line 49 of file eRectangle.h.
Referenced by Clamp(), Clear(), Clip(), Contains(), GetLow(), GetPoint(), Include(), and SetLow().
eCoord eRectangle::high_ [private] |
high corner
Definition at line 50 of file eRectangle.h.
Referenced by Clamp(), Clear(), Clip(), Contains(), GetHigh(), GetPoint(), Include(), and SetHigh().