huge commit
- worked on about everything - grid walker using plugable modules - wifi models - new distributions - worked on geometric data-structures - added typesafe timestamps - worked on grid-building - added sensor-classes - added sensor analysis (step-detection, turn-detection) - offline data reader - many test-cases
This commit is contained in:
@@ -16,19 +16,19 @@ template <typename T> class DijkstraPath {
|
||||
private:
|
||||
|
||||
/** the constructed path */
|
||||
std::vector<DijkstraNode<T>*> path;
|
||||
std::vector<const DijkstraNode<T>*> path;
|
||||
|
||||
public:
|
||||
|
||||
/** ctor from end- to start-node */
|
||||
DijkstraPath(DijkstraNode<T>* end, DijkstraNode<T>* start) {
|
||||
DijkstraPath(const DijkstraNode<T>* end, const DijkstraNode<T>* start) {
|
||||
|
||||
// sanity checks
|
||||
Assert::isNotNull(end, "end-node must not be null");
|
||||
Assert::isNotNull(start, "start-node must not be null");
|
||||
|
||||
// follow the path from the end to the start
|
||||
DijkstraNode<T>* curNode = end;
|
||||
const DijkstraNode<T>* curNode = end;
|
||||
while (curNode != start) {
|
||||
|
||||
// sanity check in case no path between start and end exists
|
||||
@@ -45,12 +45,16 @@ public:
|
||||
/** allow iteration */
|
||||
decltype(path.begin()) begin() {return path.begin();}
|
||||
decltype(path.end()) end() {return path.end();}
|
||||
// decltype(path.begin()) begin() const {return ((std::vector<const DijkstraNode<T>*>)path).begin();}
|
||||
// decltype(path.end()) end() const {return ((std::vector<const DijkstraNode<T>*>)path).end();}
|
||||
const DijkstraNode<T>& operator [] (const int idx) const {return *(path[idx]);}
|
||||
size_t size() const {return path.size();}
|
||||
|
||||
/** get the idx-th element from the starting-node. if this is beyond the end, the last node is returned */
|
||||
const DijkstraNode<T>& getFromStart(const int idx) const {return (idx >= (int) path.size()) ? (*path.back()) : (*path[idx]);}
|
||||
|
||||
const std::vector<const DijkstraNode<T>*>& getVector() const {return path;}
|
||||
|
||||
/** NANOFLANN: number of elements in the path */
|
||||
inline int kdtree_get_point_count() const {
|
||||
return path.size();
|
||||
|
||||
Reference in New Issue
Block a user