| 382 | } |
| 383 | |
| 384 | float cRandomMap::LeastCostEstimate(cPosition* nodeStart, cPosition* nodeEnd) { |
| 385 | |
| 386 | /* Compute the minimum path cost using distance measurement. It is possible |
| 387 | to compute the exact minimum path using the fact that you can move only |
| 388 | on a straight line or on a diagonal, and this will yield a better result. |
| 389 | */ |
| 390 | int dx = nodeStart->mX - nodeEnd->mX; |
| 391 | int dy = nodeStart->mY - nodeEnd->mY; |
| 392 | return (float)sqrt((double)(dx*dx) + (double)(dy*dy)); |
| 393 | } |
| 394 | |
| 395 | void cRandomMap::AdjacentCost(cPosition* node, std::vector< micropather::StateCost > *neighbors) { |
| 396 | const int dx[8] = { 8, 8, 0, -8, -8, -8, 0, 8 }; |