Handy class to describe a coordinates.It is just a point, with a set of methods that makes it useful. More...
#include <Coordinates.hh>

Public Member Functions | |
| Coordinates (int row, int col) | |
| Coordinates (const Point &point) | |
| int | getRow () const |
| int | getCol () const |
| void | setRow (int row) |
| void | setCol (int col) |
| int | getX () const |
| int | getY () const |
| void | setX (int x) |
| void | setY (int y) |
| bool | isNear (const Coordinates &from, int dist=1) const |
| Check if another point is in the neighbourhood. | |
| float | distance (const Coordinates &to) const |
| Return the distance between the two point. | |
| Coordinates & | operator+= (const Coordinates &rhs) |
Public Attributes | |
| int | row |
| Row coordinates. | |
| int | col |
| Column coordinates. | |
Friends | |
| bool | operator== (const Coordinates &lhs, const Coordinates &rhs) |
| bool | operator!= (const Coordinates &lhs, const Coordinates &rhs) |
| Coordinates | operator+ (const Coordinates &lhs, const Coordinates &rhs) |
| Coordinates | operator- (const Coordinates &lhs, const Coordinates &rhs) |
| Coordinates | operator* (int factor, const Coordinates &rhs) |
| std::ostream & | operator<< (std::ostream &os, const Coordinates &p) |
Handy class to describe a coordinates.
It is just a point, with a set of methods that makes it useful.
| bool Coordinates::isNear | ( | const Coordinates & | from, | |
| int | dist = 1 | |||
| ) | const [inline] |
Check if another point is in the neighbourhood.
The distance is calculated using the absolute norm.
| from | The other point to check for. | |
| dist | Distance allowed, diagonal authorized. |
Referenced by CPlayer::block(), Api::blockDicesNumber(), Field< T >::canAssist(), CPlayer::foul(), and sdlvisu::VisuPlayer::update().
1.6.3