HOG2
|
#include <Directional2DEnvironment.h>
Public Member Functions | |
Directional2DEnvironment (Map *m, model envType=kVehicle, heuristicType heuristic=kExtendedPerimeterHeuristic) | |
virtual | ~Directional2DEnvironment () |
void | GetSuccessors (const xySpeedHeading &nodeID, std::vector< xySpeedHeading > &neighbors) const |
void | GetActions (const xySpeedHeading &nodeID, std::vector< deltaSpeedHeading > &actions) const |
deltaSpeedHeading | GetAction (const xySpeedHeading &s1, const xySpeedHeading &s2) const |
virtual void | ApplyAction (xySpeedHeading &s, deltaSpeedHeading dir) const |
virtual void | UndoAction (xySpeedHeading &s, deltaSpeedHeading dir) const |
virtual OccupancyInterface< xySpeedHeading, deltaSpeedHeading > * | GetOccupancyInfo () |
virtual bool | InvertAction (deltaSpeedHeading &a) const |
virtual double | HCost (const xySpeedHeading &node1, const xySpeedHeading &node2) const |
Heuristic value between two arbitrary nodes. More... | |
virtual double | HCost (const xySpeedHeading &) const |
Heuristic value between node and the stored goal. More... | |
virtual double | GCost (const xySpeedHeading &node1, const xySpeedHeading &node2) const |
virtual double | GCost (const xySpeedHeading &node1, const deltaSpeedHeading &act) const |
int | GetNumAngles () |
void | SetGoalTest (GoalTester *t) |
bool | GoalTest (const xySpeedHeading &node, const xySpeedHeading &goal) const |
bool | GoalTest (const xySpeedHeading &) const |
Goal Test if the goal is stored. More... | |
uint64_t | GetStateHash (const xySpeedHeading &node) const |
uint64_t | GetActionHash (deltaSpeedHeading act) const |
virtual void | OpenGLDraw () const |
virtual void | OpenGLDraw (const xySpeedHeading &l) const |
virtual void | OpenGLDraw (const xySpeedHeading &oldState, const xySpeedHeading &newState, float perc) const |
Draw the transition at some percentage 0...1 between two states. More... | |
virtual void | OpenGLDraw (const xySpeedHeading &, const deltaSpeedHeading &) const |
void | GLDrawLine (const xySpeedHeading &a, const xySpeedHeading &b) const |
Map * | GetMap () |
void | SetHeuristicType (heuristicType theType) |
virtual void | GetNextState (const xySpeedHeading ¤ts, deltaSpeedHeading dir, xySpeedHeading &news) const |
Public Member Functions inherited from SearchEnvironment< xySpeedHeading, deltaSpeedHeading > | |
virtual | ~SearchEnvironment () |
virtual int | GetNumSuccessors (const xySpeedHeading &stateID) const |
virtual void | StoreGoal (xySpeedHeading &s) |
Stores the goal for use by single-state HCost. More... | |
virtual void | ClearGoal () |
Clears the goal from memory. More... | |
virtual bool | IsGoalStored () const |
Returns true if the goal is stored and false otherwise. More... | |
virtual double | HCost (const xySpeedHeading &node1, const xySpeedHeading &node2, double parentHCost) const |
virtual uint64_t | GetMaxHash () const |
virtual void | GetStateFromHash (uint64_t parent, xySpeedHeading &s) const |
virtual double | GetPathLength (std::vector< xySpeedHeading > &neighbors) |
virtual double | GetPathLength (const xySpeedHeading &start, std::vector< deltaSpeedHeading > &neighbors) |
virtual void | SetOccupancyInfo (OccupancyInterface< xySpeedHeading, deltaSpeedHeading > *) |
virtual void | OpenGLDraw () const |
virtual void | GLLabelState (const xySpeedHeading &, const char *) const |
virtual void | GLDrawPath (const std::vector< xySpeedHeading > &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 xySpeedHeading &) const |
virtual void | DrawLine (Graphics::Display &display, const xySpeedHeading &x, const xySpeedHeading &y, float width=1.0) const |
Public Member Functions inherited from Heuristic< xySpeedHeading > | |
Heuristic () | |
virtual | ~Heuristic () |
Protected Attributes | |
std::vector< dirHeuristicTable > | heuristics |
std::vector< float > | cosTable |
std::vector< float > | sinTable |
Map * | map |
Protected Attributes inherited from SearchEnvironment< xySpeedHeading, deltaSpeedHeading > | |
bool | bValidSearchGoal |
xySpeedHeading | searchGoal |
rgbColor | color |
GLfloat | transparency |
Private Member Functions | |
bool | Legal (const xySpeedHeading &node1, const deltaSpeedHeading &act) const |
void | BuildHTable (dirHeuristicTable &t) |
void | BuildAngleTables () |
float | mySin (int dir) const |
float | myCos (int dir) const |
float | LookupStateHash (const xySpeedHeading &s, const dirHeuristicTable &t) const |
bool | LookupStateHashIndex (const xySpeedHeading &s, int &index1, int &index2) const |
float | LookupStateHeuristic (const xySpeedHeading &s1, const xySpeedHeading &s2) const |
void | RotateCCW (xySpeedHeading &s, unsigned int rotation) const |
Private Attributes | |
bool | checkLegal |
GoalTester * | test |
model | motionModel |
heuristicType | hType |
Additional Inherited Members | |
Public Attributes inherited from Heuristic< xySpeedHeading > | |
std::vector< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Definition at line 113 of file Directional2DEnvironment.h.
Directional2DEnvironment::Directional2DEnvironment | ( | Map * | m, |
model | envType = kVehicle , |
||
heuristicType | heuristic = kExtendedPerimeterHeuristic |
||
) |
Definition at line 18 of file Directional2DEnvironment.cpp.
References BuildAngleTables(), checkLegal, hType, map, motionModel, SearchEnvironment< xySpeedHeading, deltaSpeedHeading >::SetColor(), and test.
|
virtual |
Definition at line 40 of file Directional2DEnvironment.cpp.
References map.
|
virtual |
Implements SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 273 of file Directional2DEnvironment.cpp.
References kBetterTank, kTank, motionModel, myCos(), mySin(), xySpeedHeading::rotation, deltaSpeedHeading::speed, xySpeedHeading::speed, deltaSpeedHeading::turn, xySpeedHeading::x, and xySpeedHeading::y.
Referenced by GetAction(), GetSuccessors(), and Legal().
|
private |
Definition at line 1058 of file Directional2DEnvironment.cpp.
References cosTable, kBetterTank, kTank, motionModel, sinTable, and TWOPI.
Referenced by Directional2DEnvironment().
|
private |
Definition at line 772 of file Directional2DEnvironment.cpp.
References checkLegal, fless(), GCost(), GetSuccessors(), dirHeuristicTable::hTable, LookupStateHash(), LookupStateHashIndex(), min(), motionModel, dirHeuristicTable::rotation, xySpeedHeading::rotation, ROW_SIZE, dirHeuristicTable::speed, xySpeedHeading::speed, TABLE_SIZE, xySpeedHeading::x, and xySpeedHeading::y.
|
virtual |
Implements SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 523 of file Directional2DEnvironment.cpp.
References fequal(), kBetterTank, kTank, motionModel, xySpeedHeading::rotation, deltaSpeedHeading::speed, xySpeedHeading::speed, and deltaSpeedHeading::turn.
|
virtual |
Implements SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 566 of file Directional2DEnvironment.cpp.
References GetAction(), kBetterTank, kTank, motionModel, xySpeedHeading::rotation, and xySpeedHeading::speed.
Referenced by BuildHTable().
|
virtual |
Reimplemented from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 231 of file Directional2DEnvironment.cpp.
References ApplyAction(), fequal(), GetActions(), xySpeedHeading::rotation, xySpeedHeading::speed, xySpeedHeading::x, and xySpeedHeading::y.
Referenced by GCost().
|
virtual |
Implements SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 634 of file Directional2DEnvironment.cpp.
References deltaSpeedHeading::speed, and deltaSpeedHeading::turn.
|
virtual |
Implements SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 71 of file Directional2DEnvironment.cpp.
References kBetterTank, kHumanoid, kTank, kVehicle, Legal(), motionModel, deltaSpeedHeading::speed, and deltaSpeedHeading::turn.
Referenced by GetAction(), and GetSuccessors().
|
inline |
Definition at line 145 of file Directional2DEnvironment.h.
References map.
|
virtual |
Reimplemented from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 761 of file Directional2DEnvironment.cpp.
int Directional2DEnvironment::GetNumAngles | ( | ) |
Definition at line 45 of file Directional2DEnvironment.cpp.
References kBetterTank, kHumanoid, kTank, kVehicle, and motionModel.
|
inlinevirtual |
Reimplemented from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 123 of file Directional2DEnvironment.h.
|
virtual |
Implements SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 620 of file Directional2DEnvironment.cpp.
References kBetterTank, and motionModel.
|
virtual |
Implements SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 58 of file Directional2DEnvironment.cpp.
References ApplyAction(), and GetActions().
Referenced by BuildHTable().
|
virtual |
Reimplemented from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 745 of file Directional2DEnvironment.cpp.
References SearchEnvironment< xySpeedHeading, deltaSpeedHeading >::GetColor(), Map::GetOpenGLCoord(), map, xySpeedHeading::x, and xySpeedHeading::y.
|
inlinevirtual |
Goal Test if the goal is stored.
Reimplemented from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 136 of file Directional2DEnvironment.h.
|
virtual |
Implements SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 611 of file Directional2DEnvironment.cpp.
References GoalTester::goalTest(), and test.
|
inlinevirtual |
Heuristic value between node and the stored goal.
Asserts that the goal is stored
Reimplemented from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 128 of file Directional2DEnvironment.h.
|
virtual |
Heuristic value between two arbitrary nodes.
Implements SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 486 of file Directional2DEnvironment.cpp.
References kHumanoid, kVehicle, LookupStateHeuristic(), max, motionModel, xySpeedHeading::x, and xySpeedHeading::y.
|
virtual |
Implements SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 251 of file Directional2DEnvironment.cpp.
References kBetterTank, motionModel, deltaSpeedHeading::speed, and deltaSpeedHeading::turn.
|
private |
Definition at line 500 of file Directional2DEnvironment.cpp.
References ApplyAction(), checkLegal, Map::GetTerrainType(), kBetterTank, kGround, kTank, map, motionModel, xySpeedHeading::x, and xySpeedHeading::y.
Referenced by GetActions().
|
private |
Definition at line 908 of file Directional2DEnvironment.cpp.
References dirHeuristicTable::hTable, motionModel, xySpeedHeading::rotation, ROW_SIZE, xySpeedHeading::speed, TABLE_SIZE, xySpeedHeading::x, and xySpeedHeading::y.
Referenced by BuildHTable(), and LookupStateHeuristic().
|
private |
Definition at line 890 of file Directional2DEnvironment.cpp.
References motionModel, xySpeedHeading::rotation, ROW_SIZE, xySpeedHeading::speed, TABLE_SIZE, xySpeedHeading::x, and xySpeedHeading::y.
Referenced by BuildHTable().
|
private |
Definition at line 927 of file Directional2DEnvironment.cpp.
References heuristics, hType, kOctileHeuristic, kPerimeterHeuristic, kVehicle, LookupStateHash(), motionModel, RotateCCW(), rotation, xySpeedHeading::rotation, xySpeedHeading::x, and xySpeedHeading::y.
Referenced by HCost().
|
private |
Definition at line 1077 of file Directional2DEnvironment.cpp.
References cosTable.
Referenced by ApplyAction(), OpenGLDraw(), RotateCCW(), and UndoAction().
|
private |
Definition at line 1072 of file Directional2DEnvironment.cpp.
References sinTable.
Referenced by ApplyAction(), OpenGLDraw(), RotateCCW(), and UndoAction().
|
virtual |
Definition at line 639 of file Directional2DEnvironment.cpp.
References map, and Map::OpenGLDraw().
|
virtual |
Reimplemented from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 736 of file Directional2DEnvironment.cpp.
References DrawSphere(), Map::GetOpenGLCoord(), map, xySpeedHeading::x, and xySpeedHeading::y.
|
virtual |
Reimplemented from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 691 of file Directional2DEnvironment.cpp.
References SearchEnvironment< xySpeedHeading, deltaSpeedHeading >::GetColor(), Map::GetOpenGLCoord(), map, myCos(), mySin(), recVec::normalise(), xySpeedHeading::rotation, xySpeedHeading::x, recVec::x, xySpeedHeading::y, recVec::y, and recVec::z.
|
virtual |
Draw the transition at some percentage 0...1 between two states.
Reimplemented from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 646 of file Directional2DEnvironment.cpp.
References SearchEnvironment< xySpeedHeading, deltaSpeedHeading >::GetColor(), Map::GetOpenGLCoord(), if(), kBetterTank, kTank, map, motionModel, xySpeedHeading::rotation, TWOPI, xySpeedHeading::x, and xySpeedHeading::y.
|
private |
Definition at line 263 of file Directional2DEnvironment.cpp.
References kBetterTank, kTank, motionModel, myCos(), mySin(), rotation, xySpeedHeading::rotation, xySpeedHeading::x, and xySpeedHeading::y.
Referenced by LookupStateHeuristic().
|
inline |
Definition at line 134 of file Directional2DEnvironment.h.
References test.
|
inline |
Definition at line 146 of file Directional2DEnvironment.h.
References hType.
|
virtual |
Reimplemented from SearchEnvironment< xySpeedHeading, deltaSpeedHeading >.
Definition at line 380 of file Directional2DEnvironment.cpp.
References kBetterTank, kTank, motionModel, myCos(), mySin(), xySpeedHeading::rotation, deltaSpeedHeading::speed, xySpeedHeading::speed, deltaSpeedHeading::turn, xySpeedHeading::x, and xySpeedHeading::y.
|
private |
Definition at line 160 of file Directional2DEnvironment.h.
Referenced by BuildHTable(), Directional2DEnvironment(), and Legal().
|
protected |
Definition at line 168 of file Directional2DEnvironment.h.
Referenced by BuildAngleTables(), and myCos().
|
protected |
Definition at line 165 of file Directional2DEnvironment.h.
Referenced by LookupStateHeuristic().
|
private |
Definition at line 163 of file Directional2DEnvironment.h.
Referenced by Directional2DEnvironment(), LookupStateHeuristic(), and SetHeuristicType().
|
protected |
Definition at line 170 of file Directional2DEnvironment.h.
Referenced by Directional2DEnvironment(), GetMap(), GLDrawLine(), Legal(), OpenGLDraw(), and ~Directional2DEnvironment().
|
private |
Definition at line 162 of file Directional2DEnvironment.h.
Referenced by ApplyAction(), BuildAngleTables(), BuildHTable(), Directional2DEnvironment(), GCost(), GetActions(), GetNumAngles(), GetStateHash(), HCost(), InvertAction(), Legal(), LookupStateHash(), LookupStateHashIndex(), LookupStateHeuristic(), OpenGLDraw(), RotateCCW(), and UndoAction().
|
protected |
Definition at line 169 of file Directional2DEnvironment.h.
Referenced by BuildAngleTables(), and mySin().
|
private |
Definition at line 161 of file Directional2DEnvironment.h.
Referenced by Directional2DEnvironment(), GoalTest(), and SetGoalTest().