43 bool GridPath::getPath(
float* potential,
double start_x,
double start_y,
double end_x,
double end_y, std::vector<std::pair<float, float> >& path) {
44 std::pair<float, float> current;
45 current.first = end_x;
46 current.second = end_y;
48 int start_index =
getIndex(start_x, start_y);
50 path.push_back(current);
54 while (
getIndex(current.first, current.second) != start_index) {
56 int min_x = 0, min_y = 0;
57 for (
int xd = -1; xd <= 1; xd++) {
58 for (
int yd = -1; yd <= 1; yd++) {
59 if (xd == 0 && yd == 0)
61 int x = current.first + xd,
y = current.second + yd;
63 if (potential[index] < min_val) {
64 min_val = potential[index];
70 if (min_x == 0 && min_y == 0)
72 current.first = min_x;
73 current.second = min_y;
74 path.push_back(current);
bool getPath(float *potential, double start_x, double start_y, double end_x, double end_y, std::vector< std::pair< float, float > > &path)
TFSIMD_FORCE_INLINE const tfScalar & y() const
int getIndex(int x, int y)
TFSIMD_FORCE_INLINE const tfScalar & x() const