Classes | |
| class | PointToRow |
| Lookup table internally used by SgPointUtil::Row(). More... | |
| class | PointToCol |
| Lookup table internally used by SgPointUtil::Col(). More... | |
Functions | |
| std::string | PointToString (SgPoint p) |
| SgPoint | Rotate (int rotation, SgPoint p, int size) |
| Rotate/mirror point. | |
| int | InvRotation (int rotation) |
| Return the inverse rotation as used in SgPointUtil::Rotate. | |
| char | Letter (int coord) |
| 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. | |
| std::string SgPointUtil::PointToString | ( | SgPoint | p | ) |
Definition at line 18 of file SgPoint.cpp.
References Col(), Letter(), Row(), SG_COUPONMOVE, SG_COUPONMOVE_VIRTUAL, SG_NULLMOVE, SG_PASS, and SG_RESIGN.
Referenced by operator<<().
Rotate/mirror point.
Rotates and/or mirrors a point on a given board according to a given rotation mode.
| Mode | col | row |
|---|---|---|
| 0 | col | row |
| 1 | size - col + 1 | row |
| 2 | col | size - row + 1 |
| 3 | row | col |
| 4 | size - row + 1 | col |
| 5 | row | size - col + 1 |
| 6 | size - col + 1 | size - row + 1 |
| 7 | size - row + 1 | size - col + 1 |
| rotation | The rotation mode in [0..7] | |
| p | The point to be rotated (SG_PASS is allowed and returned unmodified) | |
| size | The board size |
Definition at line 36 of file SgPoint.cpp.
References Col(), Pt(), Row(), SG_ASSERT, and SG_PASS.
Referenced by SgPointSetUtil::Rotate().
| int SgPointUtil::InvRotation | ( | int | rotation | ) |
Return the inverse rotation as used in SgPointUtil::Rotate.
| rotation | The rotation mode in [0..7] |
Definition at line 67 of file SgPoint.cpp.
References SG_ASSERT.
| char SgPointUtil::Letter | ( | int | coord | ) |
Definition at line 204 of file SgPoint.h.
Referenced by PointToString(), and SgEvaluatedMovesArray::Write().
| SgPoint SgPointUtil::Pt | ( | int | col, | |
| int | row | |||
| ) |
Converts from (col, row) to a one-dimensional point.
Only for on board points; will trigger assertion for off-board points.
Definition at line 280 of file SgPoint.h.
References SG_ASSERT_GRIDRANGE, and SG_NS.
Referenced by SgBoardConst::BoardConstImpl::BoardConstImpl(), SgRect::Center(), SgPointSet::CheckedContains(), InBoardRange(), SgPointUtil::PointToCol::PointToCol(), SgPointUtil::PointToRow::PointToRow(), SgNb4Iterator::Precomp::Precomp(), SgPointSet::PrecompAllPoints::PrecompAllPoints(), SgReadPointSet::Read(), SgReadPoint::Read(), Rotate(), SgPropUtil::SgfStringToPoint(), SgPointSet::Write(), SgWritePointArrayFloat< FLOAT >::Write(), SgWritePointArray< T >::Write(), and SgEvaluatedMovesArray::Write().
Return column of point.
The lower left corner of the coordinate grid is (1, 1).
Definition at line 262 of file SgPoint.h.
References SgPointUtil::PointToCol::Col().
Referenced by Distance(), SgRect::Include(), SgRect::InRect(), MaxDistance(), SgRectIterator::operator++(), SgPropUtil::PointToSgfString(), PointToString(), and Rotate().
Return row of point.
The lower left corner of the coordinate grid is (1, 1).
Definition at line 271 of file SgPoint.h.
References SgPointUtil::PointToRow::Row().
Referenced by Distance(), SgRect::Include(), SgRect::InRect(), MaxDistance(), SgPropUtil::PointToSgfString(), PointToString(), and Rotate().
| bool SgPointUtil::InBoardRange | ( | SgPoint | p | ) |
Definition at line 287 of file SgPoint.h.
References SgUtil::InRange(), Pt(), and SG_MAX_SIZE.
Referenced by SgEvaluatedMovesArray::AddMove(), SgEvaluatedMoves::AddMove(), SgMiaiStrategy::AddPair(), SgPropTextList::FromString(), SgPropPointList::FromString(), SgEvaluatedMovesArray::ReduceMove(), SgNb4DiagIterator::SgNb4DiagIterator(), SgNb4Iterator::SgNb4Iterator(), and SgNb8Iterator::SgNb8Iterator().
Manhattan distance between two points on the board.
Definition at line 307 of file SgPoint.h.
Referenced by SgPointSet::Center().