GridAdjacency

Declared in astar/structures/ads/GridAdjacency.h; the same class on the site of Doxygen.

template<int Moves>
class GridAdjacency

the moves from a cell of a GridMap and their costs, on the GridGraph of ADS

The interface is that of the GridAdjacency of Grid.h, and so are the moves and their costs (MoveCost::LEFT, with \( \sqrt{2} \) to a corner); the cells are visited in increasing order of index. The row of the cell s = ( x , y ) starts at s - x, so a neighbour t is in the row above, in the same one or in the row below by comparing t with that start, and its column follows with no division.

Public Types

using cost_type = std::conditional_t<Moves == 4, int, double>

the cost of a move: an integer with 4 moves, a real with 8

Public Functions

inline explicit GridAdjacency(const GridMap &map)

constructor, copying the costs of the cells of the map

template<class F>
inline void for_each(std::uint32_t s, int x, int y, F &&f) const

calls f( t , x’ , y’ , c ) for each free cell t = ( x’ , y’ ) next to the free cell s = ( x , y ), c being the cost of the move