#include "core/CoreIncludes.h" #include "core/XMLPort.h" #include "PacmanGhost.h" #include "worldentities/ControllableEntity.h" using namespace std; namespace orxonox { class getShortestPath { public: //Check if there is a collision bool jeanfindpos(Vector3 one, Vector3 other){ if((abs(one.x - other.x)<0.5) && (abs(one.y - other.y)<0.5) && (abs(one.z - other.z)<0.5)) return true; return false; } private: struct graphVertex; void findNeighboorVertices(Vector3 actuelposition, graphVertex adjacentVertices[]); struct graphVertex { Vector3 position; graphVertex *adjacentVertices[4]; //neighbooring vertices //would a vector of vector storing the neighboors not be more suitable ? int shortestDistanceToStart; //actual shortest distance to start point graphVertex* actuelPredecessor; //the predecessor giving the for now shortest //path to start graphVertex* currentNearestNonVisitedNeighboor; bool alreadyVisited; graphVertex(){ //default constructor position=0; shortestDistanceToStart= std::numeric_limits::max(); actuelPredecessor=NULL; alreadyVisited=false; for(int kl =0; kl <4;kl++){ adjacentVertices[kl]=NULL; //first put all position in array listing neighboors to 0 } } graphVertex(Vector3 wantedPosition){ //normal constructor position=wantedPosition; shortestDistanceToStart= std::numeric_limits::max(); //default distance is infinity actuelPredecessor=NULL; alreadyVisited=false; for(int kl =0; kl <4;kl++){ adjacentVertices[kl]=NULL; //first put all position in array listing neighboors to 0 } } }; }; }