HOG2
|
#include <Map2DEnvironment.h>
Public Member Functions | |
MapEnvironment (Map *m, bool useOccupancy=false) | |
MapEnvironment (MapEnvironment *) | |
virtual | ~MapEnvironment () |
void | SetGraphHeuristic (GraphHeuristic *h) |
GraphHeuristic * | GetGraphHeuristic () |
virtual void | GetSuccessors (const xyLoc &nodeID, std::vector< xyLoc > &neighbors) const |
bool | GetNextSuccessor (const xyLoc &currOpenNode, const xyLoc &goal, xyLoc &next, double &currHCost, uint64_t &special, bool &validMove) |
bool | GetNext4Successor (const xyLoc &currOpenNode, const xyLoc &goal, xyLoc &next, double &currHCost, uint64_t &special, bool &validMove) |
bool | GetNext8Successor (const xyLoc &currOpenNode, const xyLoc &goal, xyLoc &next, double &currHCost, uint64_t &special, bool &validMove) |
void | GetActions (const xyLoc &nodeID, std::vector< tDirection > &actions) const |
tDirection | GetAction (const xyLoc &s1, const xyLoc &s2) const |
virtual void | ApplyAction (xyLoc &s, tDirection dir) const |
virtual BaseMapOccupancyInterface * | GetOccupancyInfo () |
virtual bool | InvertAction (tDirection &a) const |
std::string | GetName () |
virtual double | HCost (const xyLoc &) const |
Heuristic value between node and the stored goal. More... | |
virtual double | HCost (const xyLoc &node1, const xyLoc &node2) const |
Heuristic value between two arbitrary nodes. More... | |
virtual double | GCost (const xyLoc &node1, const xyLoc &node2) const |
virtual double | GCost (const xyLoc &node1, const tDirection &act) const |
bool | GoalTest (const xyLoc &node, const xyLoc &goal) const |
bool | GoalTest (const xyLoc &) |
uint64_t | GetMaxHash () const |
uint64_t | GetStateHash (const xyLoc &node) const |
void | GetStateFromHash (uint64_t parent, xyLoc &s) const |
uint64_t | GetActionHash (tDirection act) const |
virtual void | OpenGLDraw () const |
virtual void | OpenGLDraw (const xyLoc &l) const |
virtual void | OpenGLDraw (const xyLoc &l1, const xyLoc &l2, float v) 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 | GLLabelState (const xyLoc &s, const char *str, double scale) const |
virtual void | GLDrawLine (const xyLoc &x, const xyLoc &y) const |
std::string | SVGHeader () |
std::string | SVGDraw () |
std::string | SVGDraw (const xyLoc &) |
std::string | SVGLabelState (const xyLoc &, const char *, double scale) const |
std::string | SVGLabelState (const xyLoc &, const char *, double scale, double xoff, double yoff) 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) |
void | Draw (Graphics::Display &disp) const |
void | Draw (Graphics::Display &disp, const xyLoc &l) const |
void | DrawAlternate (Graphics::Display &disp, const xyLoc &l) const |
void | Draw (Graphics::Display &disp, const xyLoc &l1, const xyLoc &l2, float v) const |
void | DrawStateLabel (Graphics::Display &disp, const xyLoc &l1, const char *txt) const |
void | DrawStateLabel (Graphics::Display &disp, const xyLoc &l1, const xyLoc &l2, float v, const char *txt) const |
void | DrawLine (Graphics::Display &disp, const xyLoc &x, const xyLoc &y, double width=1.0) const |
void | DrawArrow (Graphics::Display &disp, const xyLoc &x, const xyLoc &y, double width=1.0) const |
Graphics::point | GetStateLoc (const xyLoc &l1) |
void | SetDrawOptions (drawOptions o) |
Map * | GetMap () const |
virtual void | GetNextState (const xyLoc ¤ts, tDirection dir, xyLoc &news) const |
void | StoreGoal (xyLoc &) |
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 () |
Public Member Functions inherited from SearchEnvironment< xyLoc, tDirection > | |
virtual | ~SearchEnvironment () |
virtual int | GetNumSuccessors (const xyLoc &stateID) const |
virtual void | UndoAction (xyLoc &s, tDirection a) const |
virtual bool | IsGoalStored () const |
Returns true if the goal is stored and false otherwise. More... | |
virtual double | HCost (const xyLoc &node1, const xyLoc &node2, double parentHCost) const |
virtual bool | GoalTest (const xyLoc &node) const |
Goal Test if the goal is stored. More... | |
virtual uint64_t | GetMaxHash () const |
virtual double | GetPathLength (std::vector< xyLoc > &neighbors) |
virtual double | GetPathLength (const xyLoc &start, std::vector< tDirection > &neighbors) |
virtual void | SetOccupancyInfo (OccupancyInterface< xyLoc, tDirection > *) |
virtual void | OpenGLDraw () 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 | 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 Attributes | |
GraphHeuristic * | h |
Map * | map |
BaseMapOccupancyInterface * | oi |
double | DIAGONAL_COST |
bool | fourConnected |
drawOptions | drawParams |
Protected Attributes inherited from SearchEnvironment< xyLoc, tDirection > | |
bool | bValidSearchGoal |
xyLoc | searchGoal |
rgbColor | color |
GLfloat | transparency |
Private Member Functions | |
void | GetMaxRect (long terrain, int x, int y, int endx, int endy, std::vector< bool > &drawn, Graphics::rect &r) const |
void | DrawSingleTerrain (long terrain, Graphics::Display &disp, std::vector< bool > &drawn) const |
Additional Inherited Members | |
Public Attributes inherited from Heuristic< xyLoc > | |
std::vector< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Definition at line 133 of file Map2DEnvironment.h.
MapEnvironment::MapEnvironment | ( | Map * | m, |
bool | useOccupancy = false |
||
) |
Definition at line 18 of file Map2DEnvironment.cpp.
References kNoOptions, and ROOT_TWO.
MapEnvironment::MapEnvironment | ( | MapEnvironment * | me | ) |
Definition at line 31 of file Map2DEnvironment.cpp.
References Map::Clone(), DIAGONAL_COST, fourConnected, kNoOptions, map, and oi.
|
virtual |
Definition at line 43 of file Map2DEnvironment.cpp.
|
virtual |
Implements SearchEnvironment< xyLoc, tDirection >.
Definition at line 432 of file Map2DEnvironment.cpp.
References kE, kN, kNE, kNW, kS, kSE, kSW, kW, xyLoc::x, and xyLoc::y.
Referenced by Map2DConstrainedEnvironment::ApplyAction(), and MPLRTA::MPLRTAStar::GetPath().
|
inlinevirtual |
Clears the goal from memory.
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 205 of file Map2DEnvironment.h.
|
virtual |
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 1039 of file Map2DEnvironment.cpp.
References Colors::black, Graphics::rect::bottom, Graphics::Display::DrawLineSegments(), Graphics::Display::FillRect(), Graphics::Display::FrameRect(), kCellBorderLines, kEfficientCells, kGrass, kGround, kOutOfBounds, kSwamp, kTerrainBorderLines, kTrees, kWater, Graphics::rect::left, Colors::lightgray, px1, py1, Graphics::rect::right, and Graphics::rect::top.
Referenced by Racetrack::Draw().
|
virtual |
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 1299 of file Map2DEnvironment.cpp.
References rgbColor::b, Graphics::rect::bottom, Graphics::Display::FillCircle(), rgbColor::g, Colors::GetColor(), Graphics::rect::left, rgbColor::r, Graphics::rect::right, Graphics::rect::top, xyLoc::x, and xyLoc::y.
void MapEnvironment::Draw | ( | Graphics::Display & | disp, |
const xyLoc & | l1, | ||
const xyLoc & | l2, | ||
float | v | ||
) | const |
Definition at line 1322 of file Map2DEnvironment.cpp.
References rgbColor::b, Graphics::rect::bottom, Graphics::Display::FillCircle(), rgbColor::g, Colors::GetColor(), Graphics::rect::left, rgbColor::r, Graphics::rect::right, Graphics::rect::top, xyLoc::x, and xyLoc::y.
void MapEnvironment::DrawAlternate | ( | Graphics::Display & | disp, |
const xyLoc & | l | ||
) | const |
Definition at line 1361 of file Map2DEnvironment.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, xyLoc::x, and xyLoc::y.
void MapEnvironment::DrawArrow | ( | Graphics::Display & | disp, |
const xyLoc & | x, | ||
const xyLoc & | y, | ||
double | width = 1.0 |
||
) | const |
Definition at line 1445 of file Map2DEnvironment.cpp.
References rgbColor::b, Graphics::Display::DrawArrow(), rgbColor::g, Colors::GetColor(), rgbColor::r, width, xyLoc::x, and xyLoc::y.
void MapEnvironment::DrawLine | ( | Graphics::Display & | disp, |
const xyLoc & | x, | ||
const xyLoc & | y, | ||
double | width = 1.0 |
||
) | const |
Definition at line 1430 of file Map2DEnvironment.cpp.
References rgbColor::b, Graphics::Display::DrawLine(), rgbColor::g, Colors::GetColor(), rgbColor::r, width, xyLoc::x, and xyLoc::y.
Referenced by Map2DSectorAbstraction::Draw(), Racetrack::Draw(), Map2DSectorAbstraction::DrawLine(), and Racetrack::DrawLine().
|
private |
Definition at line 1003 of file Map2DEnvironment.cpp.
References Colors::black, Graphics::Display::FillRect(), kGrass, kGround, kSwamp, kTrees, and kWater.
void MapEnvironment::DrawStateLabel | ( | Graphics::Display & | disp, |
const xyLoc & | l1, | ||
const char * | txt | ||
) | const |
Definition at line 1392 of file Map2DEnvironment.cpp.
References rgbColor::b, Graphics::Display::DrawText(), rgbColor::g, Colors::GetColor(), rgbColor::r, xyLoc::x, and xyLoc::y.
void MapEnvironment::DrawStateLabel | ( | Graphics::Display & | disp, |
const xyLoc & | l1, | ||
const xyLoc & | l2, | ||
float | v, | ||
const char * | txt | ||
) | const |
Definition at line 1405 of file Map2DEnvironment.cpp.
References rgbColor::b, Graphics::Display::DrawText(), rgbColor::g, Colors::GetColor(), rgbColor::r, Graphics::point::x, xyLoc::x, Graphics::point::y, and xyLoc::y.
|
inline |
Definition at line 210 of file Map2DEnvironment.h.
References fourConnected.
|
inline |
Definition at line 209 of file Map2DEnvironment.h.
References fourConnected.
|
virtual |
Implements SearchEnvironment< xyLoc, tDirection >.
Definition at line 507 of file Map2DEnvironment.cpp.
References kSwamp, xyLoc::x, and xyLoc::y.
Referenced by MPLRTA::MPLRTAStar::GetPath().
|
virtual |
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 392 of file Map2DEnvironment.cpp.
References kE, kN, kS, kStay, kTeleport, kW, xyLoc::x, and xyLoc::y.
Referenced by Map2DConstrainedEnvironment::GetAction().
|
virtual |
Implements SearchEnvironment< xyLoc, tDirection >.
Definition at line 547 of file Map2DEnvironment.cpp.
|
virtual |
Implements SearchEnvironment< xyLoc, tDirection >.
Definition at line 355 of file Map2DEnvironment.cpp.
References kE, kN, kNE, kNW, kS, kSE, kSW, kW, loc::x, and loc::y.
Referenced by Map2DConstrainedEnvironment::GetActions().
|
inline |
Definition at line 208 of file Map2DEnvironment.h.
References DIAGONAL_COST.
GraphHeuristic * MapEnvironment::GetGraphHeuristic | ( | ) |
Definition at line 49 of file Map2DEnvironment.cpp.
|
inline |
Definition at line 200 of file Map2DEnvironment.h.
References map.
Referenced by MPLRTA::MPLRTAStar::GetPath(), Map2DConstrainedEnvironment::GLDrawLine(), TeleportUnit::MakeMove(), MyPathfindingKeyHandler(), MapUnit::OpenGLDraw(), and Map2DConstrainedEnvironment::OpenGLDraw().
uint64_t MapEnvironment::GetMaxHash | ( | ) | const |
Definition at line 529 of file Map2DEnvironment.cpp.
|
private |
Definition at line 953 of file Map2DEnvironment.cpp.
|
inline |
Definition at line 151 of file Map2DEnvironment.h.
References Map::GetMapName(), and map.
bool MapEnvironment::GetNext8Successor | ( | const xyLoc & | currOpenNode, |
const xyLoc & | goal, | ||
xyLoc & | next, | ||
double & | currHCost, | ||
uint64_t & | special, | ||
bool & | validMove | ||
) |
Definition at line 219 of file Map2DEnvironment.cpp.
|
virtual |
bool MapEnvironment::GetNextSuccessor | ( | const xyLoc & | currOpenNode, |
const xyLoc & | goal, | ||
xyLoc & | next, | ||
double & | currHCost, | ||
uint64_t & | special, | ||
bool & | validMove | ||
) |
Definition at line 92 of file Map2DEnvironment.cpp.
|
inlinevirtual |
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 148 of file Map2DEnvironment.h.
References oi.
|
virtual |
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 541 of file Map2DEnvironment.cpp.
|
virtual |
Implements SearchEnvironment< xyLoc, tDirection >.
Definition at line 534 of file Map2DEnvironment.cpp.
Referenced by MPLRTA::MPLRTAStar::HCost(), MPLRTA::MPLRTAStar::IsDead(), MPLRTA::MPLRTAStar::Kill(), and MPLRTA::MPLRTAStar::SetHCost().
Graphics::point MapEnvironment::GetStateLoc | ( | const xyLoc & | l1 | ) |
Definition at line 1385 of file Map2DEnvironment.cpp.
|
virtual |
Implements SearchEnvironment< xyLoc, tDirection >.
Definition at line 59 of file Map2DEnvironment.cpp.
References loc::x, and loc::y.
Referenced by MPLRTA::MPLRTAStar::GetPath(), and Map2DConstrainedEnvironment::GetSuccessors().
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 643 of file Map2DEnvironment.cpp.
References Colors::GetColor(), PI, xyLoc::x, and xyLoc::y.
|
virtual |
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 709 of file Map2DEnvironment.cpp.
References Colors::GetColor(), xyLoc::x, and xyLoc::y.
|
virtual |
Definition at line 686 of file Map2DEnvironment.cpp.
References Colors::GetColor(), xyLoc::x, and xyLoc::y.
|
inline |
Definition at line 163 of file Map2DEnvironment.h.
Implements SearchEnvironment< xyLoc, tDirection >.
Definition at line 524 of file Map2DEnvironment.cpp.
|
inlinevirtual |
Heuristic value between node and the stored goal.
Asserts that the goal is stored
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 154 of file Map2DEnvironment.h.
Referenced by MPLRTA::MPLRTAStar::HCost(), Map2DConstrainedEnvironment::HCost(), and MPLRTA::MPLRTAStar::SetHCost().
Heuristic value between two arbitrary nodes.
Implements SearchEnvironment< xyLoc, tDirection >.
Definition at line 455 of file Map2DEnvironment.cpp.
|
virtual |
Implements SearchEnvironment< xyLoc, tDirection >.
Definition at line 415 of file Map2DEnvironment.cpp.
References kE, kN, kNE, kNW, kS, kSE, kSW, and kW.
Referenced by Map2DConstrainedEnvironment::InvertAction().
|
inline |
Definition at line 206 of file Map2DEnvironment.h.
|
virtual |
Definition at line 552 of file Map2DEnvironment.cpp.
Referenced by Map2DConstrainedEnvironment::OpenGLDraw(), MPLRTA::MPLRTAStar::OpenGLDraw(), and WeightedMap2DEnvironment::OpenGLDraw().
|
virtual |
|
virtual |
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 573 of file Map2DEnvironment.cpp.
References DrawSphere(), Colors::GetColor(), xyLoc::x, and xyLoc::y.
Draw the transition at some percentage 0...1 between two states.
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 584 of file Map2DEnvironment.cpp.
References DrawSphere(), Colors::GetColor(), xyLoc::x, and xyLoc::y.
|
inline |
Definition at line 207 of file Map2DEnvironment.h.
References DIAGONAL_COST.
|
inline |
Definition at line 196 of file Map2DEnvironment.h.
References drawParams.
|
inline |
Definition at line 212 of file Map2DEnvironment.h.
References fourConnected.
|
inline |
Definition at line 211 of file Map2DEnvironment.h.
References fourConnected.
Referenced by Map2DConstrainedEnvironment::Map2DConstrainedEnvironment(), and Racetrack::UpdateMap().
void MapEnvironment::SetGraphHeuristic | ( | GraphHeuristic * | h | ) |
Definition at line 54 of file Map2DEnvironment.cpp.
|
inlinevirtual |
Stores the goal for use by single-state HCost.
Reimplemented from SearchEnvironment< xyLoc, tDirection >.
Definition at line 204 of file Map2DEnvironment.h.
std::string MapEnvironment::SVGDraw | ( | ) |
Definition at line 744 of file Map2DEnvironment.cpp.
References Colors::black, kGround, kSwamp, kTrees, kWater, SVGDrawLine(), SVGDrawRect(), SVGFrameRect(), and terrainBits.
std::string MapEnvironment::SVGDraw | ( | const xyLoc & | l | ) |
Definition at line 879 of file Map2DEnvironment.cpp.
References rgbColor::b, rgbColor::g, Colors::GetColor(), kGround, rgbColor::r, SVGDrawRect(), xyLoc::x, and xyLoc::y.
Definition at line 936 of file Map2DEnvironment.cpp.
References rgbColor::b, rgbColor::g, Colors::GetColor(), rgbColor::r, SVGDrawLine(), width, xyLoc::x, and xyLoc::y.
std::string MapEnvironment::SVGFrameRect | ( | int | left, |
int | top, | ||
int | right, | ||
int | bottom, | ||
int | width = 1 |
||
) |
Definition at line 894 of file Map2DEnvironment.cpp.
References rgbColor::b, rgbColor::g, Colors::GetColor(), rgbColor::r, SVGFrameRect(), and width.
std::string MapEnvironment::SVGHeader | ( | ) |
Definition at line 732 of file Map2DEnvironment.cpp.
std::string MapEnvironment::SVGLabelState | ( | const xyLoc & | l, |
const char * | str, | ||
double | scale | ||
) | const |
Definition at line 906 of file Map2DEnvironment.cpp.
References rgbColor::b, rgbColor::g, Colors::GetColor(), rgbColor::r, SVGDrawText(), xyLoc::x, and xyLoc::y.
std::string MapEnvironment::SVGLabelState | ( | const xyLoc & | l, |
const char * | str, | ||
double | scale, | ||
double | xoff, | ||
double | yoff | ||
) | const |
Definition at line 921 of file Map2DEnvironment.cpp.
References rgbColor::b, rgbColor::g, Colors::GetColor(), rgbColor::r, SVGDrawText(), xyLoc::x, and xyLoc::y.
|
protected |
Definition at line 223 of file Map2DEnvironment.h.
Referenced by GetDiagonalCost(), MapEnvironment(), and SetDiagonalCost().
|
protected |
Definition at line 225 of file Map2DEnvironment.h.
Referenced by SetDrawOptions().
|
protected |
Definition at line 224 of file Map2DEnvironment.h.
Referenced by EightConnected(), FourConnected(), MapEnvironment(), SetEightConnected(), and SetFourConnected().
|
protected |
Definition at line 220 of file Map2DEnvironment.h.
|
protected |
Definition at line 221 of file Map2DEnvironment.h.
Referenced by GetMap(), GetName(), and MapEnvironment().
|
protected |
Definition at line 222 of file Map2DEnvironment.h.
Referenced by GetOccupancyInfo(), and MapEnvironment().