added interface for walkers

some new helper methods
added interpolater for paths
This commit is contained in:
2016-01-28 21:48:04 +01:00
parent c4ea811342
commit da0bd43fe0
10 changed files with 92 additions and 66 deletions

View File

@@ -9,6 +9,7 @@
#include "../../nav/dijkstra/Dijkstra.h"
#include "GridWalk.h"
#include "GridWalkState.h"
#include "GridWalkHelper.h"
@@ -16,7 +17,7 @@
* perform walks on the grid based on some sort of weighting
* and drawing from the weighted elements
*/
template <typename T> class GridWalkLightAtTheEndOfTheTunnel {
template <typename T> class GridWalkLightAtTheEndOfTheTunnel : public GridWalk<T> {
friend class GridWalkHelper;
@@ -62,7 +63,7 @@ public:
}
GridWalkState<T> getDestination(Grid<T>& grid, GridWalkState<T> start, float distance_m) {
GridWalkState<T> getDestination(Grid<T>& grid, GridWalkState<T> start, float distance_m) override {
return GridWalkHelper::retryOrInvert(*this, 2, grid, start, distance_m);
@@ -72,7 +73,7 @@ private:
GridWalkState<T> walk(Grid<T>& grid, GridWalkState<T> cur, float distRest_m) {
drawer.reset();;
drawer.reset();
// calculate the weight for all possible destinations from "cur"
for (T& neighbor : grid.neighbors(*cur.node)) {