began putting everything together

This commit is contained in:
2016-01-28 21:49:36 +01:00
parent 07d739ebb7
commit 41713a5d47
30 changed files with 1446 additions and 279 deletions

29
code/DijkstraMapper.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef DIJKSTRAMAPPER_H
#define DIJKSTRAMAPPER_H
#include "MyGridNode.h"
/**
* allows dijkstra calculation on top of our data-structure
*/
class DijkstraMapper {
Grid<MyGridNode>& grid;
public:
DijkstraMapper(Grid<MyGridNode>& grid) : grid(grid) {;}
int getNumNeighbors(const MyGridNode& node) const {return node.getNumNeighbors();}
const MyGridNode* getNeighbor(const MyGridNode& node, const int idx) const {return &grid.getNeighbor(node, idx);}
float getWeightBetween(const MyGridNode& n1, const MyGridNode& n2) const {
float d = ((Point3)n1 - (Point3)n2).length(2.0);
//if (d > 20) {d*= 1.30;}
return d / std::pow(n2.imp, 3);
}
};
#endif // DIJKSTRAMAPPER_H