#include "Coordinates.hpp"
#include "RehtiReader.hpp"
#include <memory>
#include <vector>
Go to the source code of this file.
|
| bool | isValidCell (const std::vector< std::vector< uint8_t >> &map, std::pair< int, int > cell, Direction dir) |
| | Check if cell is valid and accessible from given direction. More...
|
| |
| unsigned int | euclideanDistance (std::pair< int, int > start, std::pair< int, int > end) |
| | Calculate the euclidean distance between two points. More...
|
| |
| std::vector< std::pair< int, int > > | astar (const std::vector< std::vector< uint8_t >> &map, std::pair< int, int > start, std::pair< int, int > end) |
| | A-star algorithm made to work with the access map format. Allows diagonal movement and has a heuristic of euclidean distance. More...
|
| |
◆ Direction
| Enumerator |
|---|
| NORTH | |
| NORTH_EAST | |
| EAST | |
| SOUTH_EAST | |
| SOUTH | |
| SOUTH_WEST | |
| WEST | |
| NORTH_WEST | |
◆ astar()
| std::vector<std::pair<int, int> > astar |
( |
const std::vector< std::vector< uint8_t >> & |
map, |
|
|
std::pair< int, int > |
start, |
|
|
std::pair< int, int > |
end |
|
) |
| |
A-star algorithm made to work with the access map format. Allows diagonal movement and has a heuristic of euclidean distance.
- Parameters
-
- Returns
- Returns a vector containing the path from start to finish. Start is not included in the path, but end is.
◆ euclideanDistance()
| unsigned int euclideanDistance |
( |
std::pair< int, int > |
start, |
|
|
std::pair< int, int > |
end |
|
) |
| |
Calculate the euclidean distance between two points.
- Parameters
-
| start | pair (x, y) |
| end | pair (x, y) |
- Returns
- Euclidean distance in tiles
◆ isValidCell()
| bool isValidCell |
( |
const std::vector< std::vector< uint8_t >> & |
map, |
|
|
std::pair< int, int > |
cell, |
|
|
Direction |
dir |
|
) |
| |
Check if cell is valid and accessible from given direction.
- Parameters
-
| map | The access map of the map. |
| cell | The cell to check. |
| dir | The direction from which the cell is accessed. |
- Returns
- true if the cell is valid, false otherwise.