Index   Main   Namespaces   Classes   Hierarchy   Annotated   Files   Compound   Global   Pages  
Classes | Functions

SgPointUtil Namespace Reference

Classes

class  PointToRow
 Lookup table internally used by SgPointUtil::Row(). More...
class  PointToCol
 Lookup table internally used by SgPointUtil::Col(). More...

Functions

char Letter (int coord)
std::string PointToString (SgPoint p)
SgPoint Pt (int col, int row)
 Converts from (col, row) to a one-dimensional point.
SgGrid Col (SgPoint p)
 Return column of point.
SgGrid Row (SgPoint p)
 Return row of point.
bool InBoardRange (SgPoint p)
bool AreAdjacent (SgPoint p1, SgPoint p2)
 True if the two points are adjacent to each other.
bool AreDiagonal (SgPoint p1, SgPoint p2)
 True if the two points are diagonally adjacent to each other.
int Distance (SgPoint p1, SgPoint p2)
 Manhattan distance between two points on the board.
bool In8Neighborhood (SgPoint p1, SgPoint p2)
 p2 is in 3x3 area around p1.
SgPoint Rotate (int rotation, SgPoint p, int size)
 Rotate/mirror point.
int InvRotation (int rotation)
 Return the inverse rotation as used in SgPointUtil::Rotate.

Function Documentation

bool SgPointUtil::AreAdjacent ( SgPoint  p1,
SgPoint  p2 
)

True if the two points are adjacent to each other.

Definition at line 301 of file SgPoint.h.

References SG_NS, and SG_WE.

bool SgPointUtil::AreDiagonal ( SgPoint  p1,
SgPoint  p2 
)

True if the two points are diagonally adjacent to each other.

Definition at line 308 of file SgPoint.h.

References SG_NS, and SG_WE.

SgGrid SgPointUtil::Col ( SgPoint  p  ) 

Return column of point.

The lower left corner of the coordinate grid is (1, 1).

Definition at line 272 of file SgPoint.h.

References SgPointUtil::PointToCol::Col().

Referenced by Distance(), SgRect::Include(), SgRect::InRect(), SgRectIterator::operator++(), SgPropUtil::PointToSgfString(), PointToString(), and Rotate().

int SgPointUtil::Distance ( SgPoint  p1,
SgPoint  p2 
)

Manhattan distance between two points on the board.

Definition at line 315 of file SgPoint.h.

References Col(), and Row().

Referenced by SgPointSet::Center().

bool SgPointUtil::In8Neighborhood ( SgPoint  p1,
SgPoint  p2 
)

p2 is in 3x3 area around p1.

Definition at line 322 of file SgPoint.h.

References SG_NS, and SG_WE.

bool SgPointUtil::InBoardRange ( SgPoint  p  ) 
int SgPointUtil::InvRotation ( int  rotation  ) 

Return the inverse rotation as used in SgPointUtil::Rotate.

Parameters:
rotation The rotation mode in [0..7]
Returns:
The inverse rotation mode

Definition at line 66 of file SgPoint.cpp.

References SG_ASSERT.

char SgPointUtil::Letter ( int  coord  ) 

Definition at line 214 of file SgPoint.h.

References SG_ASSERT_GRIDRANGE.

Referenced by PointToString(), and SgEvaluatedMovesArray::Write().

std::string SgPointUtil::PointToString ( SgPoint  p  ) 

Definition at line 17 of file SgPoint.cpp.

References Col(), Letter(), Row(), SG_COUPONMOVE, SG_COUPONMOVE_VIRTUAL, SG_NULLMOVE, SG_PASS, and SG_RESIGN.

Referenced by operator<<().

SgPoint SgPointUtil::Pt ( int  col,
int  row 
)
SgPoint SgPointUtil::Rotate ( int  rotation,
SgPoint  p,
int  size 
)

Rotate/mirror point.

Rotates and/or mirrors a point on a given board according to a given rotation mode.

Modecolrow
0colrow
1size - col + 1row
2colsize - row + 1
3rowcol
4size - row + 1col
5rowsize - col + 1
6size - col + 1size - row + 1
7size - row + 1size - col + 1
Parameters:
rotation The rotation mode in [0..7]
p The point to be rotated (SG_PASS is allowed and returned unmodified)
size The board size
Returns:
The rotated mirrored point

Definition at line 35 of file SgPoint.cpp.

References Col(), Pt(), Row(), SG_ASSERT, and SG_PASS.

Referenced by SgPointSetUtil::Rotate().

SgGrid SgPointUtil::Row ( SgPoint  p  ) 

Return row of point.

The lower left corner of the coordinate grid is (1, 1).

Definition at line 280 of file SgPoint.h.

References SgPointUtil::PointToRow::Row().

Referenced by Distance(), SgRect::Include(), SgRect::InRect(), SgPropUtil::PointToSgfString(), PointToString(), and Rotate().


Sun Mar 13 2011 Doxygen 1.7.1