-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathAStar.h
More file actions
41 lines (32 loc) · 1.08 KB
/
AStar.h
File metadata and controls
41 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#ifndef ASTAR_H_
#define ASTAR_H_
typedef struct coord {
int x;
int y;
} coord_t;
/* Run A* pathfinding over uniform-cost 2d grids using jump point search.
grid: 0 if obstructed, non-0 if non-obstructed (the value is ignored beyond that).
solLength: out-parameter, will contain the solution length
boundX: width of the grid
boundY: height of the grid
start: index of the starting node in the grid
end: index of the ending node in the grid
return value: Array of node indexes making up the solution, of length solLength, in reverse order
*/
int *astar_compute (const char *grid,
int *solLength,
int boundX,
int boundY,
int start,
int end);
int *astar_unopt_compute (const char *grid,
int *solLength,
int boundX,
int boundY,
int start,
int end);
/* Compute cell indexes from cell coordinates and the grid width */
int astar_getIndexByWidth (int width, int x, int y);
/* Compute coordinates from a cell index and the grid width */
void astar_getCoordByWidth (int width, int node, int *x, int *y);
#endif