Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  

SgRect Class Reference

#include <SgRect.h>

List of all members.


Detailed Description

Rectangle on the Go board.

top < bottom, coordinates grow from top to bottom.

Definition at line 17 of file 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


Constructor & Destructor Documentation

SgRect::SgRect (  ) 

Definition at line 17 of file SgRect.cpp.

SgRect::SgRect ( int  left,
int  right,
int  top,
int  bottom 
)

Definition at line 22 of file SgRect.h.

SgRect::SgRect ( const SgPoint topleft,
const SgPoint bottomright 
)

Definition at line 29 of file SgRect.h.


Member Function Documentation

int SgRect::Area (  )  const

Definition at line 131 of file SgRect.h.

References Height(), and Width().

int SgRect::Bottom (  )  const

Definition at line 114 of file SgRect.h.

References m_bottom.

Referenced by operator<<().

SgPoint SgRect::Center (  )  const

Definition at line 65 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 ( const SgRect rect  )  const

Definition at line 79 of file SgRect.cpp.

References m_bottom, m_left, m_right, and m_top.

bool SgRect::Contains ( SgPoint  p  )  const

Definition at line 88 of file SgRect.h.

References InRect().

Referenced by SgRectIterator::operator++().

void SgRect::DecBottom (  ) 

Definition at line 151 of file SgRect.h.

References m_bottom.

void SgRect::DecRight (  ) 

Definition at line 141 of file SgRect.h.

References m_right.

void SgRect::Expand ( int  margin  ) 

Definition at line 93 of file SgRect.cpp.

References m_bottom, m_left, m_right, and m_top.

int SgRect::Height (  )  const

Definition at line 125 of file SgRect.h.

References IsEmpty(), m_bottom, m_top, and SG_ASSERT.

Referenced by Area().

void SgRect::IncLeft (  ) 

Definition at line 136 of file SgRect.h.

References m_left.

void SgRect::Include ( const SgRect rect  ) 

Definition at line 45 of file SgRect.cpp.

References m_bottom, m_left, m_right, and m_top.

void SgRect::Include ( SgPoint  p  ) 

Definition at line 31 of file SgRect.cpp.

References SgPointUtil::Col(), m_bottom, m_left, m_right, m_top, and SgPointUtil::Row().

Referenced by SgPointSet::EnclosingRect().

void SgRect::IncTop (  ) 

Definition at line 146 of file SgRect.h.

References m_top.

bool SgRect::InRect ( SgPoint  p  )  const

Definition at line 71 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  ) 

Definition at line 57 of file SgRect.cpp.

References m_bottom, m_left, m_right, and m_top.

bool SgRect::IsEmpty (  )  const

Definition at line 78 of file SgRect.h.

References m_left, and m_right.

Referenced by Center(), SgPointSet::Center(), Height(), and Width().

int SgRect::Left (  )  const

Definition at line 99 of file SgRect.h.

References m_left.

Referenced by SgRectIterator::operator++(), and operator<<().

void SgRect::MirrorX ( int  boardSize  ) 

Definition at line 52 of file SgRect.h.

References m_left, and m_right.

void SgRect::MirrorY ( int  boardSize  ) 

Definition at line 59 of file SgRect.h.

References m_bottom, and m_top.

bool SgRect::operator== ( const SgRect rhs  )  const

Definition at line 36 of file SgRect.h.

References m_bottom, m_left, m_right, and m_top.

bool SgRect::Overlaps ( const SgRect rect  )  const

Definition at line 85 of file SgRect.cpp.

References m_bottom, m_left, m_right, and m_top.

int SgRect::Right (  )  const

Definition at line 104 of file SgRect.h.

References m_right.

Referenced by SgRectIterator::operator++(), and operator<<().

void SgRect::Set ( int  left,
int  right,
int  top,
int  bottom 
)

Definition at line 44 of file SgRect.h.

References m_bottom, m_left, m_right, and m_top.

void SgRect::SetBottom ( int  value  ) 

Definition at line 171 of file SgRect.h.

References m_bottom.

void SgRect::SetLeft ( int  value  ) 

Definition at line 156 of file SgRect.h.

References m_left.

void SgRect::SetRight ( int  value  ) 

Definition at line 161 of file SgRect.h.

References m_right.

void SgRect::SetTop ( int  value  ) 

Definition at line 166 of file SgRect.h.

References m_top.

void SgRect::SwapXY (  ) 

Definition at line 66 of file SgRect.h.

References m_bottom, m_left, m_right, and m_top.

int SgRect::Top (  )  const

Definition at line 109 of file SgRect.h.

References m_top.

Referenced by operator<<().

int SgRect::Width (  )  const

Definition at line 119 of file SgRect.h.

References IsEmpty(), m_left, m_right, and SG_ASSERT.

Referenced by Area().


Member Data Documentation

int SgRect::m_bottom [private]

Definition at line 183 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 177 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 179 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 181 of file SgRect.h.

Referenced by Center(), Contains(), Expand(), Height(), Include(), IncTop(), InRect(), Intersect(), MirrorY(), operator==(), Overlaps(), Set(), SetTop(), SwapXY(), and Top().


The documentation for this class was generated from the following files:


17 Jun 2010 Doxygen 1.4.7