Public Member Functions | List of all members
LineOfSight Class Reference

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...
 

Detailed Description

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.

Author
Andreychuk A.
Date
2017

Definition at line 30 of file LineOfSight.h.

Constructor & Destructor Documentation

LineOfSight::LineOfSight ( double  agentSize = 0.5)
inline

LineOfSight constructor.

Parameters
agentSizeSize of Agent relative to grid cell size.

Definition at line 37 of file LineOfSight.h.

Member Function Documentation

template<class T >
bool LineOfSight::checkLine ( int  x1,
int  y1,
int  x2,
int  y2,
const T &  map 
)
inline

Checks line-of-sight between two cells.

Parameters
x1i-coordinate of first cell of line.
y1j-coordinate of first cell of line.
x2i-coordinate of last cell of line.
y2j-coordinate of last cell of line.
mapMap object.
Returns
True, if there is a line of sight between the cells, otherwise - false.

Definition at line 225 of file LineOfSight.h.

template<class T >
bool LineOfSight::checkTraversability ( int  x,
int  y,
const T &  map 
)
inline

Checks traversability of all cells on grid affected by agent's body.

Parameters
xi-coordinate of cell.
yj-coordinate of cell.
mapMap object.
Returns
Traversability of all cells affected by agent's body

Definition at line 206 of file LineOfSight.h.

std::vector<std::pair<int, int> > LineOfSight::getCells ( int  i,
int  j 
)
inline

Returns all cells on grid that are affected by agent in position (i,j).

Parameters
ii-coordinate of first cell of line.
jj-coordinate of first cell of line.
Returns
All cells that are affected by agent in position (i,j).

Definition at line 340 of file LineOfSight.h.

template<class T >
std::vector<std::pair<int, int> > LineOfSight::getCellsCrossedByLine ( int  x1,
int  y1,
int  x2,
int  y2,
const T &  map 
)
inline

Returns all cells on grid that are affected by agent during moving along a line.

Parameters
x1i-coordinate of first cell of line.
y1j-coordinate of first cell of line.
x2i-coordinate of last cell of line.
y2j-coordinate of last cell of line.
mapMap object.
Returns
All cells that are affected by agent during moving along a line.

Definition at line 84 of file LineOfSight.h.

void LineOfSight::setSize ( double  agentSize)
inline

Set size of agent.

Parameters
agentSizeSize of Agent relative to grid cell size.

Definition at line 57 of file LineOfSight.h.


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


ORCAStar
Author(s): Stepan Drgachev
autogenerated on Wed Jul 15 2020 16:13:14