24 #include "../Math_LIB/MPath.h"
25 #include "../Math_LIB/MInterpolator.h"
26 #include "../Utils_LIB/UPrecisionTimer.h"
34 namespace OpenSkyNet {
146 float _targetRadiusSqrd;
149 bool _isDriverPathControlled;
154 void createRelativePath(
const std::vector<CD::DIRECTION>& pathDirs_);
155 void createRelativePath(
const std::vector<DirOrPath>& dirsOrPaths_);
157 inline void decrementDriverAndTargetBins() {
159 for (i = 1; i < _drivBins.size(); i++) _grid->
decrementBin(_drivBins[i]);
160 for (i = 1; i < _targBins.size(); i++) _grid->
decrementBin(_targBins[i]);
163 inline void incrementDriverAndTargetBins() {
165 for (i = 1; i < _drivBins.size(); i++) _grid->
incrementBin(_drivBins[i]);
166 for (i = 1; i < _targBins.size(); i++) _grid->
incrementBin(_targBins[i]);
169 double _timeStampIsStuckPrev;
170 double _timeStampIsStuckCurr;
171 double _numSecsWithSameDrivBin;
174 inline void clearAttemptedDirs() {
182 double _timeStampBegin;
184 std::vector<Math::Point<int> > _drivBins, _targBins;
185 Math::Point<> _currDriver, _currTarget;
188 const std::map<const CD::Volume*, WaypointCollection*>* _volWPCMap;
192 PriorityQueue _prioQ;
195 RESULT findPathAStar(
double secsAllotted_=-1.0);
196 RESULT findPathBFS(
double secsAllotted_=-1.0);
207 _drivBoundingVolume = drivBoundingVolume_;
216 float targetRadius_=-1.0f) {
218 _targBoundingVolume = targBoundingVolume_;
219 if (targetRadius_ < 0.0f)
223 _targetRadiusSqrd = targetRadius_ * targetRadius_;
227 inline void setWPCs(
const std::map<const CD::Volume*, WaypointCollection*>* volWPCMap_) { _volWPCMap = volWPCMap_; }
238 inline const std::vector<Math::Point<int> >&
getDriverBins()
const {
return _drivBins; }
239 inline const std::vector<Math::Point<int> >&
getTargetBins()
const {
return _targBins; }
256 _drivPath = &drivPath_;
257 _isDriverPathControlled =
true;
260 if (!_drivPath)
return false;
261 _isDriverPathControlled =
true;
void resetPathfindingVars()
Definition: PFManager.cpp:373
RESULT calcDriverAndTargetBins(bool calcPositions_=false, bool useInitialGrid_=false)
Definition: PFManager.h:234
void controlDriverPath(Math::Path *&drivPath_)
Definition: PFManager.h:255
virtual RESULT findPath(Manager::ALGORITHM algo_=Manager::A_STAR, bool doUpdateMaxCorner_=true, double secsAllotted_=-1.0)
Definition: PFManager.cpp:73
const std::vector< Math::Point< int > > & getDriverBins() const
Definition: PFManager.h:238
const std::vector< Math::Point< int > > & getTargetBins() const
Definition: PFManager.h:239
Manager()
Definition: PFManager.cpp:24
virtual bool isStuck()
Definition: PFManager.cpp:48
bool isTargetBinOutsideGrid() const
Definition: PFManager.cpp:390
bool decrementBin(const Math::Point< int > &bin_)
Definition: CDGrid.h:261
void setTarget(const Math::Point<> *target_, const CD::Volume *targBoundingVolume_, float targetRadius_=-1.0f)
Definition: PFManager.h:215
const CD::Grid * getGrid() const
Definition: PFManager.h:247
Definition: CDVolume.h:225
Definition: PFManager.h:132
bool isDriverBinOutsideGrid() const
Definition: PFManager.cpp:380
RESULT
Definition: PFConsts.h:33
float getBoundingRadius() const
Definition: CDVolume.h:234
Definition: PFManager.h:132
virtual RESULT calcDriverAndTargetBins(std::vector< Math::Point< int > > &drivBins_, std::vector< Math::Point< int > > &targBins_, bool calcPositions_=false, bool useInitialGrid_=false)
ALGORITHM
Definition: PFManager.h:132
unsigned int uint
Definition: UTypes.h:39
virtual ~Manager()
Definition: PFManager.cpp:46
const Math::Point * getTarget() const
Definition: PFManager.h:245
Definition: PFManager.h:129
Utils::PrecisionTimer g_timer
Definition: PFManager.cpp:12
Math::Path & getFoundPath()
Definition: PFManager.h:268
Definition: UPrecisionTimer.h:58
bool isDriverPathControlled() const
Definition: PFManager.h:265
void releaseDriverPath()
Definition: PFManager.h:264
void setDriver(const Math::Point<> *driver_, const CD::Volume *drivBoundingVolume_)
Definition: PFManager.h:205
bool controlDriverPath()
Definition: PFManager.h:259
void incrementBin(const Math::Point< int > &bin_)
Definition: CDGrid.h:272
const Math::Point * getDriver() const
Definition: PFManager.h:242