Public Member Functions | List of all members
Map Class Reference

Map class describes static environment. More...

#include <Map.h>

Public Member Functions

bool CellIsObstacle (int i, int j) const
 Check Cell (i,j) is obstacle. More...
 
bool CellIsTraversable (int i, int j) const
 Check Cell (i,j) is traversable. More...
 
bool CellOnGrid (int i, int j) const
 Check Cell (i,j) is inside grid. More...
 
float GetCellSize () const
 Return size of cell side. More...
 
Node GetClosestNode (const Point &point) const
 Return cell to which point in orthogonal coordinates belong. More...
 
unsigned int GetHeight () const
 Return height of grid. More...
 
const std::vector< std::vector< ObstacleSegment > > & GetObstacles () const
 Return obstacles in form of polygons. More...
 
Point GetPoint (const Node &node) const
 Return center of grid cell in orthogonal coordinates. More...
 
unsigned int GetWidth () const
 Return width of grid. More...
 
 Map ()
 Map default constructor. More...
 
 Map (float cellSize, std::vector< std::vector< int >> &grid, std::vector< std::vector< Point >> &obstacles)
 Map constructor with parameters. More...
 
 Map (const Map &obj)
 Map copy constructor. More...
 
Mapoperator= (const Map &obj)
 Assignment operator. More...
 
 ~Map ()
 Map destructor. More...
 

Detailed Description

Map class describes static environment.

This class contains main information about static environment. The map is set in the form of a grid, are also described in the form of polygons. The grid is a rectangular matrix of square cells, each cell can be traversable or not. The size of cell side is set by the value of cellSize. The address of each cell on the grid is specified by a pair (i, j), where i is the row number of the matrix, j is the column number of the matrix The environment description is specified in the orthogonal coordinates. Every obstacle in form of polygon is vector of points in orthogonal coordinates. Vertices of the simple obstacle shold be listed in counterclockwise order, vertices of boundary in clockwise order. An illustration of the environment is presented in the figure below.

Map sheme

Definition at line 36 of file Map.h.

Constructor & Destructor Documentation

Map::Map ( )

Map default constructor.

Definition at line 9 of file Map.cpp.

Map::Map ( float  cellSize,
std::vector< std::vector< int >> &  grid,
std::vector< std::vector< Point >> &  obstacles 
)

Map constructor with parameters.

Parameters
cellSizeSize of cell side.
gridMatrix of traversability of environment. Every cell can be 0 (traversable) or 1 (obstacle).
obstaclesVector of obstacles in form of polygons. Every obstacle is vector of points in orthogonal coordinates. Vertices of the simple obstacle shold be listed in counterclockwise order, vertices of boundary in clockwise order.

Definition at line 19 of file Map.cpp.

Map::Map ( const Map obj)

Map copy constructor.

Parameters
objObject to copy.

Definition at line 77 of file Map.cpp.

Map::~Map ( )

Map destructor.

Definition at line 87 of file Map.cpp.

Member Function Documentation

bool Map::CellIsObstacle ( int  i,
int  j 
) const

Check Cell (i,j) is obstacle.

Parameters
iRow number in the matrix.
jColumn number in the matrix
Returns
True if obstacle, otherwise false.

Definition at line 103 of file Map.cpp.

bool Map::CellIsTraversable ( int  i,
int  j 
) const

Check Cell (i,j) is traversable.

Parameters
iRow number in the matrix.
jColumn number in the matrix
Returns
False if obstacle, otherwise true.

Definition at line 109 of file Map.cpp.

bool Map::CellOnGrid ( int  i,
int  j 
) const

Check Cell (i,j) is inside grid.

Parameters
iRow number in the matrix.
jColumn number in the matrix
Returns
True if inside grid, otherwise false.

Definition at line 115 of file Map.cpp.

float Map::GetCellSize ( ) const

Return size of cell side.

Returns
Size of cell side.

Definition at line 133 of file Map.cpp.

Node Map::GetClosestNode ( const Point point) const

Return cell to which point in orthogonal coordinates belong.

Parameters
pointPoint in orthogonal coordinates .
Returns
Cell of grid matrix.

Definition at line 139 of file Map.cpp.

unsigned int Map::GetHeight ( ) const

Return height of grid.

Returns
Number of rows in grid matrix

Definition at line 121 of file Map.cpp.

const std::vector< std::vector< ObstacleSegment > > & Map::GetObstacles ( ) const

Return obstacles in form of polygons.

Returns
Vector of polygons.

Definition at line 171 of file Map.cpp.

Point Map::GetPoint ( const Node node) const

Return center of grid cell in orthogonal coordinates.

Parameters
nodeGrid cell.
Returns
Position of grid cell center in orthogonal coordinates.

Definition at line 166 of file Map.cpp.

unsigned int Map::GetWidth ( ) const

Return width of grid.

Returns
Number of columns in grid matrix

Definition at line 127 of file Map.cpp.

Map & Map::operator= ( const Map obj)

Assignment operator.

Parameters
objMap to assignment.
Returns
Reference to map.

Definition at line 176 of file Map.cpp.


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


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