HOG2
|
#include <CanonicalGrid.h>
Public Member Functions | |
CanonicalGrid (Map *m) | |
void | GetSuccessors (const xyLoc &nodeID, std::vector< xyLoc > &neighbors) const |
void | GetActions (const xyLoc &nodeID, std::vector< tDirection > &actions) const |
tDirection | GetAction (const xyLoc &s1, const xyLoc &s2) const |
void | ApplyAction (xyLoc &s, tDirection dir) const |
bool | InvertAction (tDirection &a) const |
double | HCost (const xyLoc &) const |
double | HCost (const xyLoc &node1, const xyLoc &node2) const |
double | GCost (const xyLoc &node1, const xyLoc &node2) const |
double | GCost (const xyLoc &node1, const tDirection &act) const |
bool | GoalTest (const xyLoc &node, const xyLoc &goal) const |
bool | GoalTest (const xyLoc &) const |
uint64_t | GetMaxHash () const |
uint64_t | GetStateHash (const xyLoc &node) const |
uint64_t | GetActionHash (tDirection act) const |
void | OpenGLDraw () const |
void | OpenGLDraw (const xyLoc &l) const |
void | OpenGLDraw (const xyLoc &l1, const xyLoc &l2, float v) const |
void | OpenGLDraw (const xyLoc &, const tDirection &) const |
void | GLLabelState (const xyLoc &, const char *) const |
void | GLLabelState (const xyLoc &s, const char *str, double scale) const |
void | GLDrawLine (const xyLoc &x, const xyLoc &y) const |
Map * | GetMap () const |
std::string | SVGHeader () |
std::string | SVGDraw () |
std::string | SVGDraw (const xyLoc &) |
std::string | SVGLabelState (const xyLoc &, const char *, double scale) const |
std::string | SVGDrawLine (const xyLoc &x, const xyLoc &y, int width=1) const |
std::string | SVGFrameRect (int left, int top, int right, int bottom, int width=1) |
virtual void | Draw (Graphics::Display &disp) const |
virtual void | Draw (Graphics::Display &disp, const xyLoc &l) const |
virtual void | DrawAlternate (Graphics::Display &disp, const xyLoc &l) const |
virtual void | Draw (Graphics::Display &disp, const xyLoc &l1, const xyLoc &l2, float v) const |
virtual void | DrawStateLabel (Graphics::Display &disp, const xyLoc &l1, const char *txt) const |
virtual void | DrawStateLabel (Graphics::Display &disp, const xyLoc &l1, const xyLoc &l2, float v, const char *txt) const |
virtual void | DrawLine (Graphics::Display &disp, const xyLoc &x, const xyLoc &y, double width=1.0) const |
virtual void | DrawArrow (Graphics::Display &disp, const xyLoc &x, const xyLoc &y, double width=1.0) const |
void | DrawBasicOrdering (::Graphics::Display &disp, const xyLoc l) const |
void | DrawOrdering (::Graphics::Display &disp, const xyLoc l) const |
void | GetFirstJumpPoints (const xyLoc &nodeID, std::vector< xyLoc > &neighbors) const |
void | GetNextState (const xyLoc ¤ts, tDirection dir, xyLoc &news) const |
void | StoreGoal (xyLoc &) |
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 () |
Public Member Functions inherited from SearchEnvironment< xyLoc, tDirection > | |
virtual | ~SearchEnvironment () |
virtual void | GetSuccessors (const xyLoc &nodeID, std::vector< xyLoc > &neighbors) const=0 |
virtual void | GetActions (const xyLoc &nodeID, std::vector< tDirection > &actions) const=0 |
virtual int | GetNumSuccessors (const xyLoc &stateID) const |
virtual tDirection | GetAction (const xyLoc &s1, const xyLoc &s2) const |
virtual void | ApplyAction (xyLoc &s, tDirection a) const=0 |
virtual void | UndoAction (xyLoc &s, tDirection a) const |
virtual void | GetNextState (const xyLoc &s1, tDirection a, xyLoc &s2) const |
virtual bool | InvertAction (tDirection &a) const=0 |
virtual void | StoreGoal (xyLoc &s) |
Stores the goal for use by single-state HCost. More... | |
virtual bool | IsGoalStored () const |
Returns true if the goal is stored and false otherwise. More... | |
virtual double | HCost (const xyLoc &node1, const xyLoc &node2) const=0 |
Heuristic value between two arbitrary nodes. More... | |
virtual double | HCost (const xyLoc &node1, const xyLoc &node2, double parentHCost) const |
virtual double | HCost (const xyLoc &node) const |
Heuristic value between node and the stored goal. More... | |
virtual double | GCost (const xyLoc &node1, const xyLoc &node2) const=0 |
virtual double | GCost (const xyLoc &node, const tDirection &act) const=0 |
virtual bool | GoalTest (const xyLoc &node, const xyLoc &goal) const=0 |
virtual bool | GoalTest (const xyLoc &node) const |
Goal Test if the goal is stored. More... | |
virtual uint64_t | GetMaxHash () const |
virtual uint64_t | GetStateHash (const xyLoc &node) const=0 |
virtual void | GetStateFromHash (uint64_t parent, xyLoc &s) const |
virtual uint64_t | GetActionHash (tDirection act) const=0 |
virtual double | GetPathLength (std::vector< xyLoc > &neighbors) |
virtual double | GetPathLength (const xyLoc &start, std::vector< tDirection > &neighbors) |
virtual OccupancyInterface< xyLoc, tDirection > * | GetOccupancyInfo () |
virtual void | SetOccupancyInfo (OccupancyInterface< xyLoc, tDirection > *) |
virtual void | OpenGLDraw () const |
virtual void | OpenGLDraw (const xyLoc &) const |
virtual void | OpenGLDraw (const xyLoc &, const xyLoc &, float) const |
Draw the transition at some percentage 0...1 between two states. More... | |
virtual void | OpenGLDraw (const xyLoc &, const tDirection &) const |
virtual void | GLLabelState (const xyLoc &, const char *) const |
virtual void | GLDrawLine (const xyLoc &x, const xyLoc &y) const |
virtual void | GLDrawPath (const std::vector< xyLoc > &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 xyLoc &) const |
virtual void | DrawLine (Graphics::Display &display, const xyLoc &x, const xyLoc &y, float width=1.0) const |
Public Member Functions inherited from Heuristic< xyLoc > | |
Heuristic () | |
virtual | ~Heuristic () |
Protected Member Functions | |
void | GetBasicSuccessors (const xyLoc &nodeID, std::vector< xyLoc > &neighbors) const |
Protected Attributes | |
Map * | map |
double | DIAGONAL_COST |
bool | fourConnected |
std::vector< bool > | grid |
Protected Attributes inherited from SearchEnvironment< xyLoc, tDirection > | |
bool | bValidSearchGoal |
xyLoc | searchGoal |
rgbColor | color |
GLfloat | transparency |
Additional Inherited Members | |
Public Attributes inherited from Heuristic< xyLoc > | |
std::vector< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Definition at line 53 of file CanonicalGrid.h.
CanonicalGrid::CanonicalGrid::CanonicalGrid | ( | Map * | m | ) |
Definition at line 18 of file CanonicalGrid.cpp.
References Map::GetMapHeight(), Map::GetMapWidth(), Map::GetTerrainType(), kGround, ROOT_TWO, and terrainBits.
void CanonicalGrid::CanonicalGrid::ApplyAction | ( | xyLoc & | s, |
tDirection | dir | ||
) | const |
Definition at line 353 of file CanonicalGrid.cpp.
References CanonicalGrid::kE, CanonicalGrid::kN, CanonicalGrid::kNE, CanonicalGrid::kNW, CanonicalGrid::kS, CanonicalGrid::kSE, CanonicalGrid::kSW, CanonicalGrid::kW, CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
|
inlinevirtual |
Clears the goal from memory.
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 111 of file CanonicalGrid.h.
|
virtual |
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 862 of file CanonicalGrid.cpp.
References Colors::black, Graphics::rect::bottom, Graphics::Display::DrawLineSegments(), Graphics::Display::FillRect(), Graphics::Display::FrameRect(), kGround, kSwamp, kTrees, kWater, Graphics::rect::left, px1, py1, Graphics::rect::right, terrainBits, and Graphics::rect::top.
|
virtual |
Definition at line 1058 of file CanonicalGrid.cpp.
References rgbColor::b, Graphics::Display::FillCircle(), rgbColor::g, Colors::GetColor(), rgbColor::r, CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
|
virtual |
Definition at line 1082 of file CanonicalGrid.cpp.
References rgbColor::b, Graphics::rect::bottom, Graphics::Display::FrameCircle(), rgbColor::g, Colors::GetColor(), Graphics::rect::left, rgbColor::r, Graphics::rect::right, Graphics::rect::top, CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
|
virtual |
Definition at line 1121 of file CanonicalGrid.cpp.
References rgbColor::b, Graphics::rect::bottom, Graphics::Display::FrameCircle(), rgbColor::g, Colors::GetColor(), Graphics::rect::left, rgbColor::r, Graphics::rect::right, Graphics::rect::top, CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
|
virtual |
Definition at line 1195 of file CanonicalGrid.cpp.
References rgbColor::b, Graphics::Display::DrawArrow(), rgbColor::g, Colors::GetColor(), rgbColor::r, width, CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
void CanonicalGrid::CanonicalGrid::DrawBasicOrdering | ( | ::Graphics::Display & | disp, |
const xyLoc | l | ||
) | const |
Definition at line 769 of file CanonicalGrid.cpp.
References Graphics::Display::DrawLine(), Colors::GetColor(), Graphics::point::x, and Graphics::point::y.
|
virtual |
Definition at line 1180 of file CanonicalGrid.cpp.
References rgbColor::b, Graphics::Display::DrawLine(), rgbColor::g, Colors::GetColor(), rgbColor::r, width, CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
void CanonicalGrid::CanonicalGrid::DrawOrdering | ( | ::Graphics::Display & | disp, |
const xyLoc | l | ||
) | const |
Definition at line 814 of file CanonicalGrid.cpp.
References Graphics::Display::DrawLine(), Colors::GetColor(), Graphics::point::x, and Graphics::point::y.
|
virtual |
Definition at line 1142 of file CanonicalGrid.cpp.
References rgbColor::b, Graphics::Display::DrawText(), rgbColor::g, Colors::GetColor(), rgbColor::r, CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
|
virtual |
Definition at line 1155 of file CanonicalGrid.cpp.
References rgbColor::b, Graphics::Display::DrawText(), rgbColor::g, Colors::GetColor(), rgbColor::r, CanonicalGrid::xyLoc::x, Graphics::point::x, CanonicalGrid::xyLoc::y, and Graphics::point::y.
|
inline |
Definition at line 116 of file CanonicalGrid.h.
|
inline |
Definition at line 115 of file CanonicalGrid.h.
double CanonicalGrid::CanonicalGrid::GCost | ( | const xyLoc & | node1, |
const tDirection & | act | ||
) | const |
Definition at line 387 of file CanonicalGrid.cpp.
References CanonicalGrid::kE, CanonicalGrid::kN, CanonicalGrid::kNE, CanonicalGrid::kNW, CanonicalGrid::kS, CanonicalGrid::kSE, CanonicalGrid::kSW, and CanonicalGrid::kW.
Definition at line 405 of file CanonicalGrid.cpp.
References CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
tDirection CanonicalGrid::CanonicalGrid::GetAction | ( | const xyLoc & | s1, |
const xyLoc & | s2 | ||
) | const |
Definition at line 315 of file CanonicalGrid.cpp.
References CanonicalGrid::kE, CanonicalGrid::kN, CanonicalGrid::kS, CanonicalGrid::kStay, CanonicalGrid::kW, CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
uint64_t CanonicalGrid::CanonicalGrid::GetActionHash | ( | tDirection | act | ) | const |
Definition at line 432 of file CanonicalGrid.cpp.
void CanonicalGrid::CanonicalGrid::GetActions | ( | const xyLoc & | nodeID, |
std::vector< tDirection > & | actions | ||
) | const |
Definition at line 277 of file CanonicalGrid.cpp.
References CanonicalGrid::kE, CanonicalGrid::kN, CanonicalGrid::kNE, CanonicalGrid::kNW, CanonicalGrid::kS, CanonicalGrid::kSE, CanonicalGrid::kSW, CanonicalGrid::kW, loc::x, and loc::y.
|
protected |
Definition at line 201 of file CanonicalGrid.cpp.
References CanonicalGrid::kE, CanonicalGrid::kN, CanonicalGrid::kNE, CanonicalGrid::kNW, CanonicalGrid::kS, CanonicalGrid::kSE, CanonicalGrid::kSW, CanonicalGrid::kW, loc::x, and loc::y.
|
inline |
Definition at line 114 of file CanonicalGrid.h.
void CanonicalGrid::CanonicalGrid::GetFirstJumpPoints | ( | const xyLoc & | nodeID, |
std::vector< xyLoc > & | neighbors | ||
) | const |
Definition at line 165 of file CanonicalGrid.cpp.
|
inline |
Definition at line 86 of file CanonicalGrid.h.
uint64_t CanonicalGrid::CanonicalGrid::GetMaxHash | ( | ) | const |
Definition at line 419 of file CanonicalGrid.cpp.
void CanonicalGrid::CanonicalGrid::GetNextState | ( | const xyLoc & | currents, |
tDirection | dir, | ||
xyLoc & | news | ||
) | const |
Definition at line 1210 of file CanonicalGrid.cpp.
References CanonicalGrid::kE, CanonicalGrid::kN, CanonicalGrid::kNE, CanonicalGrid::kNW, CanonicalGrid::kS, CanonicalGrid::kSE, CanonicalGrid::kSW, CanonicalGrid::kW, CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
uint64_t CanonicalGrid::CanonicalGrid::GetStateHash | ( | const xyLoc & | node | ) | const |
Definition at line 425 of file CanonicalGrid.cpp.
void CanonicalGrid::CanonicalGrid::GetSuccessors | ( | const xyLoc & | nodeID, |
std::vector< xyLoc > & | neighbors | ||
) | const |
Definition at line 36 of file CanonicalGrid.cpp.
References CanonicalGrid::kE, CanonicalGrid::kN, CanonicalGrid::kNE, CanonicalGrid::kNW, CanonicalGrid::kS, CanonicalGrid::kSE, CanonicalGrid::kSW, CanonicalGrid::kW, loc::x, and loc::y.
Definition at line 502 of file CanonicalGrid.cpp.
References Colors::GetColor(), PI, CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
void CanonicalGrid::CanonicalGrid::GLLabelState | ( | const xyLoc & | s, |
const char * | str | ||
) | const |
Definition at line 550 of file CanonicalGrid.cpp.
References Colors::GetColor(), CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
void CanonicalGrid::CanonicalGrid::GLLabelState | ( | const xyLoc & | s, |
const char * | str, | ||
double | scale | ||
) | const |
Definition at line 528 of file CanonicalGrid.cpp.
References Colors::GetColor(), CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
|
inline |
Definition at line 72 of file CanonicalGrid.h.
Definition at line 414 of file CanonicalGrid.cpp.
References CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
|
inline |
Definition at line 64 of file CanonicalGrid.h.
Definition at line 370 of file CanonicalGrid.cpp.
References CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
bool CanonicalGrid::CanonicalGrid::InvertAction | ( | tDirection & | a | ) | const |
Definition at line 336 of file CanonicalGrid.cpp.
References CanonicalGrid::kE, CanonicalGrid::kN, CanonicalGrid::kNE, CanonicalGrid::kNW, CanonicalGrid::kS, CanonicalGrid::kSE, CanonicalGrid::kSW, and CanonicalGrid::kW.
|
inline |
Definition at line 112 of file CanonicalGrid.h.
void CanonicalGrid::CanonicalGrid::OpenGLDraw | ( | ) | const |
Definition at line 437 of file CanonicalGrid.cpp.
void CanonicalGrid::CanonicalGrid::OpenGLDraw | ( | const xyLoc & | initial, |
const tDirection & | dir | ||
) | const |
Definition at line 471 of file CanonicalGrid.cpp.
References CanonicalGrid::kE, CanonicalGrid::kN, CanonicalGrid::kNE, CanonicalGrid::kNW, CanonicalGrid::kS, CanonicalGrid::kSE, CanonicalGrid::kSW, CanonicalGrid::kW, CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
void CanonicalGrid::CanonicalGrid::OpenGLDraw | ( | const xyLoc & | l | ) | const |
Definition at line 442 of file CanonicalGrid.cpp.
References DrawSquare(), Colors::GetColor(), CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
Definition at line 455 of file CanonicalGrid.cpp.
References DrawSquare(), Colors::GetColor(), CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
|
inline |
Definition at line 113 of file CanonicalGrid.h.
|
inline |
Definition at line 118 of file CanonicalGrid.h.
|
inline |
Definition at line 117 of file CanonicalGrid.h.
|
inline |
Definition at line 110 of file CanonicalGrid.h.
std::string CanonicalGrid::CanonicalGrid::SVGDraw | ( | ) |
Definition at line 583 of file CanonicalGrid.cpp.
References Colors::black, kGround, kSwamp, kTrees, kWater, SVGDrawLine(), SVGDrawRect(), SVGFrameRect(), and terrainBits.
std::string CanonicalGrid::CanonicalGrid::SVGDraw | ( | const xyLoc & | l | ) |
Definition at line 711 of file CanonicalGrid.cpp.
References rgbColor::b, rgbColor::g, Colors::GetColor(), kGround, rgbColor::r, SVGDrawCircle(), CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
std::string CanonicalGrid::CanonicalGrid::SVGDrawLine | ( | const xyLoc & | x, |
const xyLoc & | y, | ||
int | width = 1 |
||
) | const |
Definition at line 752 of file CanonicalGrid.cpp.
References rgbColor::b, rgbColor::g, Colors::GetColor(), rgbColor::r, SVGDrawLine(), width, CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
std::string CanonicalGrid::CanonicalGrid::SVGFrameRect | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom, | ||
int | width = 1 |
||
) |
Definition at line 725 of file CanonicalGrid.cpp.
References rgbColor::b, rgbColor::g, Colors::GetColor(), rgbColor::r, SVGFrameRect(), and width.
std::string CanonicalGrid::CanonicalGrid::SVGHeader | ( | ) |
Definition at line 571 of file CanonicalGrid.cpp.
std::string CanonicalGrid::CanonicalGrid::SVGLabelState | ( | const xyLoc & | l, |
const char * | str, | ||
double | scale | ||
) | const |
Definition at line 737 of file CanonicalGrid.cpp.
References rgbColor::b, rgbColor::g, Colors::GetColor(), rgbColor::r, SVGDrawText(), CanonicalGrid::xyLoc::x, and CanonicalGrid::xyLoc::y.
|
protected |
Definition at line 122 of file CanonicalGrid.h.
|
protected |
Definition at line 123 of file CanonicalGrid.h.
|
protected |
Definition at line 124 of file CanonicalGrid.h.
|
protected |
Definition at line 121 of file CanonicalGrid.h.