HOG2
|
#include <Map2DHeading.h>
Classes | |
struct | hdData |
Public Member Functions | |
Map2DHeading (Map *m) | |
virtual | ~Map2DHeading () |
virtual void | GetSuccessors (const xyhLoc &nodeID, std::vector< xyhLoc > &neighbors) const |
void | GetActions (const xyhLoc &nodeID, std::vector< xyhAct > &actions) const |
xyhAct | GetAction (const xyhLoc &s1, const xyhLoc &s2) const |
virtual void | ApplyAction (xyhLoc &s, xyhAct dir) const |
virtual bool | InvertAction (xyhAct &a) const |
virtual double | HCost (const xyhLoc &) const |
Heuristic value between node and the stored goal. More... | |
virtual double | HCost (const xyhLoc &node1, const xyhLoc &node2) const |
Heuristic value between two arbitrary nodes. More... | |
virtual double | GCost (const xyhLoc &node1, const xyhLoc &node2) const |
virtual double | GCost (const xyhLoc &node1, const xyhAct &act) const |
bool | GoalTest (const xyhLoc &node, const xyhLoc &goal) const |
bool | GoalTest (const xyhLoc &) const |
Goal Test if the goal is stored. More... | |
uint64_t | GetStateHash (const xyhLoc &node) const |
void | GetStateFromHash (uint64_t hash, xyhLoc &node) const |
uint64_t | GetActionHash (xyhAct act) const |
virtual void | OpenGLDraw () const |
virtual void | OpenGLDraw (const xyhLoc &l) const |
virtual void | OpenGLDraw (const xyhLoc &l1, const xyhLoc &l2, float v) const |
Draw the transition at some percentage 0...1 between two states. More... | |
virtual void | OpenGLDraw (const xyhLoc &, const xyhAct &) const |
virtual void | GLLabelState (const xyhLoc &, const char *) const |
virtual void | GLDrawLine (const xyhLoc &x, const xyhLoc &y) const |
Map * | GetMap () const |
virtual void | GetNextState (const xyhLoc ¤ts, xyhAct dir, xyhLoc &news) const |
void | StoreGoal (xyhLoc &) |
Stores the goal for use by single-state HCost. More... | |
void | ClearGoal () |
Clears the goal from memory. More... | |
bool | IsGoalStored () const |
void | SetDiagonalCost (double val) |
double | GetDiagonalCost () |
bool | FourConnected () |
bool | EightConnected () |
void | SetFourConnected () |
void | SetEightConnected () |
void | SetCost (const xyhLoc &, double seen, double dist) |
void | ClearCost (const xyhLoc &) |
void | ClearAllCosts () |
Public Member Functions inherited from SearchEnvironment< xyhLoc, xyhAct > | |
virtual | ~SearchEnvironment () |
virtual int | GetNumSuccessors (const xyhLoc &stateID) const |
virtual void | UndoAction (xyhLoc &s, xyhAct a) const |
virtual bool | IsGoalStored () const |
Returns true if the goal is stored and false otherwise. More... | |
virtual double | HCost (const xyhLoc &node1, const xyhLoc &node2, double parentHCost) const |
virtual uint64_t | GetMaxHash () const |
virtual double | GetPathLength (std::vector< xyhLoc > &neighbors) |
virtual double | GetPathLength (const xyhLoc &start, std::vector< xyhAct > &neighbors) |
virtual OccupancyInterface< xyhLoc, xyhAct > * | GetOccupancyInfo () |
virtual void | SetOccupancyInfo (OccupancyInterface< xyhLoc, xyhAct > *) |
virtual void | OpenGLDraw () const |
virtual void | GLDrawPath (const std::vector< xyhLoc > &x) const |
virtual void | SetColor (const rgbColor &r) const |
virtual void | SetColor (GLfloat rr, GLfloat g, GLfloat b, GLfloat t=1.0) const |
virtual void | GetColor (GLfloat &rr, GLfloat &g, GLfloat &b, GLfloat &t) const |
virtual rgbColor | GetColor () const |
virtual void | Draw (Graphics::Display &display) const |
virtual void | Draw (Graphics::Display &display, const xyhLoc &) const |
virtual void | DrawLine (Graphics::Display &display, const xyhLoc &x, const xyhLoc &y, float width=1.0) const |
Public Member Functions inherited from Heuristic< xyhLoc > | |
Heuristic () | |
virtual | ~Heuristic () |
Public Attributes | |
bool | drawWeights |
Public Attributes inherited from Heuristic< xyhLoc > | |
std::vector< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Protected Types | |
typedef std::unordered_map< uint64_t, hdData, Hash64 > | CostTable |
Protected Member Functions | |
double | GetCost (const xyhLoc &a, const xyhLoc &b, double P, double d) const |
bool | LegalState (const xyhLoc &s) |
void | BuildAngleTables () |
float | mySin (int dir) const |
float | myCos (int dir) const |
Protected Attributes | |
Map * | map |
double | DIAGONAL_COST |
bool | fourConnected |
std::vector< float > | cosTable |
std::vector< float > | sinTable |
CostTable | costs |
Protected Attributes inherited from SearchEnvironment< xyhLoc, xyhAct > | |
bool | bValidSearchGoal |
xyhLoc | searchGoal |
rgbColor | color |
GLfloat | transparency |
Definition at line 46 of file Map2DHeading.h.
|
protected |
Definition at line 113 of file Map2DHeading.h.
Map2DHeading::Map2DHeading | ( | Map * | m | ) |
Definition at line 15 of file Map2DHeading.cpp.
References BuildAngleTables(), DIAGONAL_COST, drawWeights, and map.
|
virtual |
Definition at line 23 of file Map2DHeading.cpp.
Implements SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 71 of file Map2DHeading.cpp.
References xyhLoc::h, xyhAct::newHeading, xyhAct::oldHeading, xyhLoc::x, and xyhLoc::y.
Referenced by GetNextState(), and GetSuccessors().
|
protected |
Definition at line 364 of file Map2DHeading.cpp.
References cosTable, sinTable, and TWOPI.
Referenced by Map2DHeading().
void Map2DHeading::ClearAllCosts | ( | ) |
Definition at line 397 of file Map2DHeading.cpp.
void Map2DHeading::ClearCost | ( | const xyhLoc & | l | ) |
Definition at line 392 of file Map2DHeading.cpp.
References GetStateHash().
|
inlinevirtual |
Clears the goal from memory.
Reimplemented from SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 89 of file Map2DHeading.h.
|
inline |
Definition at line 94 of file Map2DHeading.h.
References fourConnected.
|
inline |
Definition at line 93 of file Map2DHeading.h.
References fourConnected.
Implements SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 167 of file Map2DHeading.cpp.
References DIAGONAL_COST, GetCost(), GetStateFromHash(), xyhAct::newHeading, and xyhAct::oldHeading.
Implements SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 140 of file Map2DHeading.cpp.
References DIAGONAL_COST, GetCost(), GetStateFromHash(), and xyhLoc::h.
Reimplemented from SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 63 of file Map2DHeading.cpp.
References xyhLoc::h, xyhAct::newHeading, and xyhAct::oldHeading.
|
virtual |
Implements SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 223 of file Map2DHeading.cpp.
References xyhAct::newHeading, and xyhAct::oldHeading.
|
virtual |
Implements SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 44 of file Map2DHeading.cpp.
References Map::CanStep(), GetNextState(), xyhLoc::h, map, xyhAct::newHeading, xyhAct::oldHeading, xyhLoc::x, and xyhLoc::y.
|
inline |
Definition at line 92 of file Map2DHeading.h.
References DIAGONAL_COST.
|
inline |
Definition at line 84 of file Map2DHeading.h.
References map.
|
virtual |
Reimplemented from SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 358 of file Map2DHeading.cpp.
References ApplyAction().
Referenced by GetActions().
|
virtual |
Reimplemented from SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 214 of file Map2DHeading.cpp.
Referenced by GCost(), and OpenGLDraw().
|
virtual |
Implements SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 205 of file Map2DHeading.cpp.
Referenced by ClearCost(), and SetCost().
|
virtual |
Implements SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 28 of file Map2DHeading.cpp.
References ApplyAction(), Map::CanStep(), xyhLoc::h, map, xyhAct::newHeading, xyhAct::oldHeading, xyhLoc::x, and xyhLoc::y.
Reimplemented from SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 352 of file Map2DHeading.cpp.
|
virtual |
Reimplemented from SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 347 of file Map2DHeading.cpp.
|
inlinevirtual |
Goal Test if the goal is stored.
Reimplemented from SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 69 of file Map2DHeading.h.
Implements SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 200 of file Map2DHeading.cpp.
|
inlinevirtual |
Heuristic value between node and the stored goal.
Asserts that the goal is stored
Reimplemented from SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 61 of file Map2DHeading.h.
Heuristic value between two arbitrary nodes.
Implements SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 97 of file Map2DHeading.cpp.
References DIAGONAL_COST, xyhLoc::h, xyhLoc::x, and xyhLoc::y.
|
virtual |
Implements SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 92 of file Map2DHeading.cpp.
|
inline |
Definition at line 90 of file Map2DHeading.h.
|
protected |
Definition at line 193 of file Map2DHeading.cpp.
References Map::GetTerrainType(), kGround, map, xyhLoc::x, and xyhLoc::y.
|
protected |
|
protected |
|
virtual |
Definition at line 228 of file Map2DHeading.cpp.
References drawWeights, GetStateFromHash(), map, Map::OpenGLDraw(), and SearchEnvironment< xyhLoc, xyhAct >::SetColor().
Reimplemented from SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 342 of file Map2DHeading.cpp.
|
virtual |
Reimplemented from SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 244 of file Map2DHeading.cpp.
References SearchEnvironment< xyhLoc, xyhAct >::GetColor(), Map::GetOpenGLCoord(), xyhLoc::h, map, myCos(), mySin(), recVec::normalise(), xyhLoc::x, recVec::x, xyhLoc::y, recVec::y, and recVec::z.
Draw the transition at some percentage 0...1 between two states.
Reimplemented from SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 283 of file Map2DHeading.cpp.
References SearchEnvironment< xyhLoc, xyhAct >::GetColor(), Map::GetOpenGLCoord(), xyhLoc::h, if(), map, recVec::normalise(), TWOPI, xyhLoc::x, recVec::x, xyhLoc::y, recVec::y, and recVec::z.
void Map2DHeading::SetCost | ( | const xyhLoc & | l, |
double | seen, | ||
double | dist | ||
) |
Definition at line 386 of file Map2DHeading.cpp.
References d, and GetStateHash().
|
inline |
Definition at line 91 of file Map2DHeading.h.
References DIAGONAL_COST.
|
inline |
Definition at line 96 of file Map2DHeading.h.
References fourConnected.
|
inline |
Definition at line 95 of file Map2DHeading.h.
References fourConnected.
|
inlinevirtual |
Stores the goal for use by single-state HCost.
Reimplemented from SearchEnvironment< xyhLoc, xyhAct >.
Definition at line 88 of file Map2DHeading.h.
|
protected |
Definition at line 106 of file Map2DHeading.h.
Referenced by BuildAngleTables(), and myCos().
|
protected |
Definition at line 114 of file Map2DHeading.h.
|
protected |
Definition at line 104 of file Map2DHeading.h.
Referenced by GCost(), GetDiagonalCost(), HCost(), Map2DHeading(), and SetDiagonalCost().
bool Map2DHeading::drawWeights |
Definition at line 101 of file Map2DHeading.h.
Referenced by Map2DHeading(), and OpenGLDraw().
|
protected |
Definition at line 105 of file Map2DHeading.h.
Referenced by EightConnected(), FourConnected(), SetEightConnected(), and SetFourConnected().
|
protected |
Definition at line 103 of file Map2DHeading.h.
Referenced by GetActions(), GetMap(), GetSuccessors(), LegalState(), Map2DHeading(), and OpenGLDraw().
|
protected |
Definition at line 107 of file Map2DHeading.h.
Referenced by BuildAngleTables(), and mySin().