This class implements line-of-sight function between two cells on the grid for a variable size of agent. More...
#include <LineOfSight.h>
Public Member Functions | |
| template<class T > | |
| bool | checkLine (int x1, int y1, int x2, int y2, const T &map) |
| Checks line-of-sight between two cells. More... | |
| template<class T > | |
| bool | checkTraversability (int x, int y, const T &map) |
| Checks traversability of all cells on grid affected by agent's body. More... | |
| std::vector< std::pair< int, int > > | getCells (int i, int j) |
| Returns all cells on grid that are affected by agent in position (i,j). More... | |
| template<class T > | |
| std::vector< std::pair< int, int > > | getCellsCrossedByLine (int x1, int y1, int x2, int y2, const T &map) |
| Returns all cells on grid that are affected by agent during moving along a line. More... | |
| LineOfSight (double agentSize=0.5) | |
| LineOfSight constructor. More... | |
| void | setSize (double agentSize) |
| Set size of agent. More... | |
This class implements line-of-sight function between two cells on the grid for a variable size of agent.
It also has a method for checking cell's traversability. For its work is needed the size of agent and a map container that has 'cellIsObstacle' and 'cellOnGrid' methods.
Definition at line 30 of file LineOfSight.h.
|
inline |
LineOfSight constructor.
| agentSize | Size of Agent relative to grid cell size. |
Definition at line 37 of file LineOfSight.h.
|
inline |
Checks line-of-sight between two cells.
| x1 | i-coordinate of first cell of line. |
| y1 | j-coordinate of first cell of line. |
| x2 | i-coordinate of last cell of line. |
| y2 | j-coordinate of last cell of line. |
| map | Map object. |
Definition at line 225 of file LineOfSight.h.
|
inline |
Checks traversability of all cells on grid affected by agent's body.
| x | i-coordinate of cell. |
| y | j-coordinate of cell. |
| map | Map object. |
Definition at line 206 of file LineOfSight.h.
|
inline |
Returns all cells on grid that are affected by agent in position (i,j).
| i | i-coordinate of first cell of line. |
| j | j-coordinate of first cell of line. |
Definition at line 340 of file LineOfSight.h.
|
inline |
Returns all cells on grid that are affected by agent during moving along a line.
| x1 | i-coordinate of first cell of line. |
| y1 | j-coordinate of first cell of line. |
| x2 | i-coordinate of last cell of line. |
| y2 | j-coordinate of last cell of line. |
| map | Map object. |
Definition at line 84 of file LineOfSight.h.
|
inline |
Set size of agent.
| agentSize | Size of Agent relative to grid cell size. |
Definition at line 57 of file LineOfSight.h.