Rectangle on the Go board. More...
#include <SgRect.h>
Public Member Functions | |
SgRect () | |
SgRect (int left, int right, int top, int bottom) | |
SgRect (const SgPoint &topleft, const SgPoint &bottomright) | |
bool | operator== (const SgRect &rhs) const |
void | Set (int left, int right, int top, int bottom) |
void | MirrorX (int boardSize) |
void | MirrorY (int boardSize) |
void | SwapXY () |
void | Include (SgPoint p) |
void | Include (const SgRect &rect) |
void | Intersect (const SgRect &rect) |
bool | IsEmpty () const |
bool | InRect (SgPoint p) const |
SgPoint | Center () const |
bool | Contains (SgPoint p) const |
bool | Contains (const SgRect &rect) const |
bool | Overlaps (const SgRect &rect) const |
void | Expand (int margin) |
int | Left () const |
int | Right () const |
int | Top () const |
int | Bottom () const |
int | Width () const |
int | Height () const |
int | Area () const |
void | IncLeft () |
void | DecRight () |
void | IncTop () |
void | DecBottom () |
void | SetLeft (int value) |
void | SetRight (int value) |
void | SetTop (int value) |
void | SetBottom (int value) |
Private Attributes | |
int | m_left |
int | m_right |
int | m_top |
int | m_bottom |
Rectangle on the Go board.
top < bottom, coordinates grow from top to bottom.
Definition at line 15 of file SgRect.h.
SgRect::SgRect | ( | ) |
Definition at line 16 of file SgRect.cpp.
int SgRect::Area | ( | ) | const |
int SgRect::Bottom | ( | ) | const |
SgPoint SgRect::Center | ( | ) | const |
Definition at line 64 of file SgRect.cpp.
References IsEmpty(), m_bottom, m_left, m_right, m_top, SgPointUtil::Pt(), and SG_ASSERT.
Referenced by SgPointSet::Center().
bool SgRect::Contains | ( | SgPoint | p | ) | const |
Definition at line 86 of file SgRect.h.
References InRect().
Referenced by SgRectIterator::operator++().
bool SgRect::Contains | ( | const SgRect & | rect | ) | const |
void SgRect::Expand | ( | int | margin | ) |
int SgRect::Height | ( | ) | const |
void SgRect::Include | ( | SgPoint | p | ) |
Definition at line 30 of file SgRect.cpp.
References SgPointUtil::Col(), m_bottom, m_left, m_right, m_top, and SgPointUtil::Row().
Referenced by SgPointSet::EnclosingRect().
void SgRect::Include | ( | const SgRect & | rect | ) |
bool SgRect::InRect | ( | SgPoint | p | ) | const |
Definition at line 70 of file SgRect.cpp.
References SgPointUtil::Col(), m_bottom, m_left, m_top, and SgPointUtil::Row().
Referenced by Contains().
void SgRect::Intersect | ( | const SgRect & | rect | ) |
bool SgRect::IsEmpty | ( | ) | const |
int SgRect::Left | ( | ) | const |
Definition at line 97 of file SgRect.h.
References m_left.
Referenced by SgRectIterator::operator++(), and operator<<().
void SgRect::MirrorX | ( | int | boardSize | ) |
void SgRect::MirrorY | ( | int | boardSize | ) |
bool SgRect::operator== | ( | const SgRect & | rhs | ) | const |
bool SgRect::Overlaps | ( | const SgRect & | rect | ) | const |
int SgRect::Right | ( | ) | const |
Definition at line 102 of file SgRect.h.
References m_right.
Referenced by SgRectIterator::operator++(), and operator<<().
void SgRect::Set | ( | int | left, | |
int | right, | |||
int | top, | |||
int | bottom | |||
) |
void SgRect::SwapXY | ( | ) |
int SgRect::Top | ( | ) | const |
int SgRect::Width | ( | ) | const |
int SgRect::m_bottom [private] |
Definition at line 181 of file SgRect.h.
Referenced by Bottom(), Center(), Contains(), DecBottom(), Expand(), Height(), Include(), InRect(), Intersect(), MirrorY(), operator==(), Overlaps(), Set(), SetBottom(), and SwapXY().
int SgRect::m_left [private] |
Definition at line 175 of file SgRect.h.
Referenced by Center(), Contains(), Expand(), IncLeft(), Include(), InRect(), Intersect(), IsEmpty(), Left(), MirrorX(), operator==(), Overlaps(), Set(), SetLeft(), SwapXY(), and Width().
int SgRect::m_right [private] |
Definition at line 177 of file SgRect.h.
Referenced by Center(), Contains(), DecRight(), Expand(), Include(), Intersect(), IsEmpty(), MirrorX(), operator==(), Overlaps(), Right(), Set(), SetRight(), SwapXY(), and Width().
int SgRect::m_top [private] |
Definition at line 179 of file SgRect.h.
Referenced by Center(), Contains(), Expand(), Height(), Include(), IncTop(), InRect(), Intersect(), MirrorY(), operator==(), Overlaps(), Set(), SetTop(), SwapXY(), and Top().