HOG2
|
#include <Map3DGrid.h>
Public Member Functions | |
Map3DGrid (int width, int height, int theSectorSize) | |
Map3DGrid (Map *map, int theSectorSize) | |
int | GetWidth () |
int | GetHeight () |
void | PrintStats () |
int | GetAbstractionBytesUsed () |
int | GetGridBytesUsed () |
void | AddMap (Map *map, int elevation) |
void | GetSuccessors (const state3d &nodeID, std::vector< state3d > &neighbors) const |
void | GetActions (const state3d &nodeID, std::vector< action3d > &actions) const |
void | ApplyAction (state3d &s, action3d a) const |
bool | InvertAction (action3d &a) const |
action3d | GetAction (const state3d &s1, const state3d &s2) const |
double | HCost (const state3d &node1, const state3d &node2) const |
Heuristic value between two arbitrary nodes. More... | |
double | GCost (const state3d &node1, const state3d &node2) const |
double | GCost (const state3d &node, const action3d &act) const |
bool | GoalTest (const state3d &node, const state3d &goal) const |
uint64_t | GetStateHash (const state3d &node) const |
uint64_t | GetActionHash (action3d act) const |
int | FindNearState (int x, int y, int z, state3d &s) const |
void | OpenGLDraw () const |
void | OpenGLDraw (const state3d &) const |
void | OpenGLDraw (const state3d &, const action3d &) const |
void | GLDrawLine (const state3d &x, const state3d &y) const |
bool | AddPoint (int x, int y, int z) |
bool | RemovePoint (int x, int y, int z, bool split=true) |
void | SetDrawGrid (bool draw) |
bool | GetDrawGrid () |
void | GetPointFromCoordinate (point3d loc, int &px, int &py, int &pz) const |
Public Member Functions inherited from SearchEnvironment< state3d, action3d > | |
virtual | ~SearchEnvironment () |
virtual int | GetNumSuccessors (const state3d &stateID) const |
virtual void | UndoAction (state3d &s, action3d a) const |
virtual void | GetNextState (const state3d &s1, action3d a, state3d &s2) const |
virtual void | StoreGoal (state3d &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 state3d &node1, const state3d &node2, double parentHCost) const |
virtual double | HCost (const state3d &node) const |
Heuristic value between node and the stored goal. More... | |
virtual bool | GoalTest (const state3d &node) const |
Goal Test if the goal is stored. More... | |
virtual uint64_t | GetMaxHash () const |
virtual void | GetStateFromHash (uint64_t parent, state3d &s) const |
virtual double | GetPathLength (std::vector< state3d > &neighbors) |
virtual double | GetPathLength (const state3d &start, std::vector< action3d > &neighbors) |
virtual OccupancyInterface< state3d, action3d > * | GetOccupancyInfo () |
virtual void | SetOccupancyInfo (OccupancyInterface< state3d, action3d > *) |
virtual void | OpenGLDraw () const |
virtual void | OpenGLDraw (const state3d &, const state3d &, float) const |
Draw the transition at some percentage 0...1 between two states. More... | |
virtual void | GLLabelState (const state3d &, const char *) const |
virtual void | GLDrawPath (const std::vector< state3d > &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 state3d &) const |
virtual void | DrawLine (Graphics::Display &display, const state3d &x, const state3d &y, float width=1.0) const |
Public Member Functions inherited from Heuristic< state3d > | |
Heuristic () | |
virtual | ~Heuristic () |
Private Member Functions | |
void | AddEdge (state3d &from, state3d &to) |
int | AddGridEdge (state3d &from, state3d &to, bool local) |
int | AddSectorEdge (state3d &from, state3d &to) |
void | AddEdge (int sec1, int reg1, int sec2, int reg2, int weight) |
void | AddMapPoints (Map *map, std::vector< bool > &visited, int x, int y, int elevation) |
int | InternalRemovePoint (int x, int y, int z) |
void | RemoveEdge (int sec1, int reg1, int sec2, int reg2, int weight) |
void | RemoveEdge (state3d &from, state3d &to) |
int | RemoveGridEdge (state3d &from, state3d &to) |
int | RemoveSectorEdge (state3d &from, state3d &to) |
int | GetSector (int x, int y) const |
void | GetXYFromState (const state3d &s, int &x, int &y) const |
void | GetXYZFromState (const state3d &s, int &x, int &y, int &z) const |
void | GetStateFromXYZ (state3d &s, int x, int y, int z) const |
void | GetOpenGLCoord (int xLoc, int yLoc, int zLoc, GLdouble &x, GLdouble &y, GLdouble &z, GLdouble &r, GLdouble &h) const |
Private Attributes | |
int | mWidth |
int | mHeight |
int | mXSectors |
int | mYSectors |
std::vector< SectorData > | sectors |
bool | drawGrid |
Additional Inherited Members | |
Public Attributes inherited from Heuristic< state3d > | |
std::vector< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Protected Attributes inherited from SearchEnvironment< state3d, action3d > | |
bool | bValidSearchGoal |
state3d | searchGoal |
rgbColor | color |
GLfloat | transparency |
Definition at line 200 of file Map3DGrid.h.
Map3DGrid::Map3DGrid | ( | int | width, |
int | height, | ||
int | theSectorSize | ||
) |
Definition at line 459 of file Map3DGrid.cpp.
References drawGrid, gSectorSize, height, mXSectors, mYSectors, sectors, and width.
Map3DGrid::Map3DGrid | ( | Map * | map, |
int | theSectorSize | ||
) |
Definition at line 446 of file Map3DGrid.cpp.
References AddMap(), drawGrid, Map::GetMapHeight(), Map::GetMapWidth(), gSectorSize, mHeight, mWidth, mXSectors, mYSectors, and sectors.
|
private |
Definition at line 1016 of file Map3DGrid.cpp.
References sectors.
Definition at line 1029 of file Map3DGrid.cpp.
References AddGridEdge(), AddSectorEdge(), state3d::GetOffset(), state3d::GetRegion(), state3d::GetSector(), state3d::region, and state3d::sector.
Referenced by AddPoint().
Definition at line 1059 of file Map3DGrid.cpp.
References gSectorSize, kEast, kNorth, kNorthEast, kNorthWest, kSouth, kSouthEast, kSouthWest, kWest, state3d::offset, state3d::region, state3d::sector, and sectors.
Referenced by AddEdge().
void Map3DGrid::AddMap | ( | Map * | map, |
int | elevation | ||
) |
Definition at line 470 of file Map3DGrid.cpp.
References AddMapPoints(), Map::GetMapHeight(), Map::GetMapWidth(), Map::GetTerrainType(), kGround, and terrainBits.
Referenced by Map3DGrid().
|
private |
Definition at line 483 of file Map3DGrid.cpp.
References AddPoint(), Map::GetMapWidth(), GetSector(), Map::GetTerrainType(), kGround, and terrainBits.
Referenced by AddMap().
bool Map3DGrid::AddPoint | ( | int | x, |
int | y, | ||
int | z | ||
) |
Definition at line 867 of file Map3DGrid.cpp.
References AddEdge(), FindNearState(), GetSector(), GetXYFromState(), mHeight, mWidth, and sectors.
Referenced by AddMapPoints(), and RemovePoint().
Definition at line 1090 of file Map3DGrid.cpp.
References GetXYFromState(), kEast, kNorth, kNorthEast, kNorthWest, kSouth, kSouthEast, kSouthWest, kWest, mWidth, state3d::offset, state3d::region, state3d::sector, and sectors.
Referenced by AddEdge().
Implements SearchEnvironment< state3d, action3d >.
Definition at line 806 of file Map3DGrid.cpp.
References action3d::destRegion, action3d::destSector, action3d::direction, state3d::GetOffset(), GetStateFromXYZ(), GetXYZFromState(), state3d::Init(), kEast, kNorth, kNorthEast, kNorthWest, kSouth, kSouthEast, kSouthWest, and kWest.
int Map3DGrid::FindNearState | ( | int | x, |
int | y, | ||
int | z, | ||
state3d & | s | ||
) | const |
Definition at line 1383 of file Map3DGrid.cpp.
References GetSector(), gSectorSize, height, indexFromXY(), state3d::Init(), kUnpassableHeight, mHeight, mWidth, and sectors.
Referenced by AddPoint(), GetStateFromXYZ(), and InternalRemovePoint().
Implements SearchEnvironment< state3d, action3d >.
Definition at line 843 of file Map3DGrid.cpp.
Implements SearchEnvironment< state3d, action3d >.
Definition at line 837 of file Map3DGrid.cpp.
int Map3DGrid::GetAbstractionBytesUsed | ( | ) |
Definition at line 1625 of file Map3DGrid.cpp.
References sectors.
Reimplemented from SearchEnvironment< state3d, action3d >.
Definition at line 215 of file Map3DGrid.h.
|
virtual |
Implements SearchEnvironment< state3d, action3d >.
Definition at line 861 of file Map3DGrid.cpp.
|
virtual |
Implements SearchEnvironment< state3d, action3d >.
Definition at line 785 of file Map3DGrid.cpp.
References action3d::destRegion, action3d::direction, state3d::GetOffset(), state3d::GetRegion(), state3d::GetSector(), kEast, kNorth, kNorthEast, kNorthWest, kSouth, kSouthEast, kSouthWest, kWest, and sectors.
|
inline |
Definition at line 236 of file Map3DGrid.h.
References drawGrid.
int Map3DGrid::GetGridBytesUsed | ( | ) |
Definition at line 1638 of file Map3DGrid.cpp.
References gSectorSize, and sectors.
|
inline |
Definition at line 205 of file Map3DGrid.h.
References mHeight.
|
private |
Definition at line 1591 of file Map3DGrid.cpp.
References max, mHeight, and mWidth.
Referenced by GLDrawLine(), and OpenGLDraw().
void Map3DGrid::GetPointFromCoordinate | ( | point3d | loc, |
int & | px, | ||
int & | py, | ||
int & | pz | ||
) | const |
|
inlineprivate |
Definition at line 253 of file Map3DGrid.h.
References gSectorSize, and mXSectors.
Referenced by AddMapPoints(), AddPoint(), FindNearState(), InternalRemovePoint(), and RemovePoint().
|
private |
Definition at line 1418 of file Map3DGrid.cpp.
References FindNearState().
Referenced by ApplyAction(), and GetSuccessors().
|
virtual |
Implements SearchEnvironment< state3d, action3d >.
Definition at line 855 of file Map3DGrid.cpp.
|
virtual |
Implements SearchEnvironment< state3d, action3d >.
Definition at line 531 of file Map3DGrid.cpp.
References action3d::destRegion, state3d::GetOffset(), state3d::GetRegion(), state3d::GetSector(), GetStateFromXYZ(), GetXYZFromState(), gSectorSize, kEast, kNorth, kNorthEast, kNorthWest, kSouth, kSouthEast, kSouthWest, kWest, state3d::offset, and sectors.
Referenced by OpenGLDraw().
|
inline |
Definition at line 204 of file Map3DGrid.h.
References mWidth.
|
private |
Definition at line 1403 of file Map3DGrid.cpp.
References state3d::GetOffset(), state3d::GetSector(), gSectorSize, mXSectors, and xyFromIndex().
Referenced by AddPoint(), AddSectorEdge(), GetXYZFromState(), and RemoveSectorEdge().
|
private |
Definition at line 1411 of file Map3DGrid.cpp.
References state3d::GetOffset(), state3d::GetRegion(), state3d::GetSector(), GetXYFromState(), and sectors.
Referenced by ApplyAction(), GetSuccessors(), and GLDrawLine().
Reimplemented from SearchEnvironment< state3d, action3d >.
Definition at line 1565 of file Map3DGrid.cpp.
References SearchEnvironment< state3d, action3d >::GetColor(), GetOpenGLCoord(), and GetXYZFromState().
Referenced by OpenGLDraw().
Implements SearchEnvironment< state3d, action3d >.
Definition at line 849 of file Map3DGrid.cpp.
Heuristic value between two arbitrary nodes.
Implements SearchEnvironment< state3d, action3d >.
Definition at line 831 of file Map3DGrid.cpp.
|
private |
Definition at line 1198 of file Map3DGrid.cpp.
References FindNearState(), state3d::GetRegion(), state3d::GetSector(), GetSector(), RemoveEdge(), and sectors.
Referenced by RemovePoint().
|
inlinevirtual |
Implements SearchEnvironment< state3d, action3d >.
Definition at line 214 of file Map3DGrid.h.
void Map3DGrid::OpenGLDraw | ( | ) | const |
Definition at line 1442 of file Map3DGrid.cpp.
References drawGrid, GetOpenGLCoord(), GetSuccessors(), GLDrawLine(), gSectorSize, indexFromXY(), state3d::Init(), mHeight, mWidth, mXSectors, sectors, SearchEnvironment< state3d, action3d >::SetColor(), and xyFromIndex().
|
virtual |
Reimplemented from SearchEnvironment< state3d, action3d >.
Definition at line 1560 of file Map3DGrid.cpp.
Reimplemented from SearchEnvironment< state3d, action3d >.
Definition at line 229 of file Map3DGrid.h.
void Map3DGrid::PrintStats | ( | ) |
Definition at line 1606 of file Map3DGrid.cpp.
References sectors.
|
private |
Definition at line 1271 of file Map3DGrid.cpp.
References sectors.
Referenced by InternalRemovePoint(), and RemoveEdge().
Definition at line 1279 of file Map3DGrid.cpp.
References state3d::region, RemoveEdge(), RemoveGridEdge(), RemoveSectorEdge(), and state3d::sector.
Definition at line 1297 of file Map3DGrid.cpp.
References gSectorSize, kEast, kNorth, kNorthEast, kNorthWest, kSouth, kSouthEast, kSouthWest, kWest, state3d::offset, state3d::region, state3d::sector, and sectors.
Referenced by RemoveEdge().
bool Map3DGrid::RemovePoint | ( | int | x, |
int | y, | ||
int | z, | ||
bool | split = true |
||
) |
Definition at line 1141 of file Map3DGrid.cpp.
References AddPoint(), GetSector(), gSectorSize, InternalRemovePoint(), sectors, and split().
Definition at line 1330 of file Map3DGrid.cpp.
References GetXYFromState(), kEast, kNorth, kNorthEast, kNorthWest, kSouth, kSouthEast, kSouthWest, kWest, mWidth, state3d::offset, state3d::region, state3d::sector, and sectors.
Referenced by RemoveEdge().
|
inline |
Definition at line 235 of file Map3DGrid.h.
References drawGrid.
|
private |
Definition at line 263 of file Map3DGrid.h.
Referenced by GetDrawGrid(), Map3DGrid(), OpenGLDraw(), and SetDrawGrid().
|
private |
Definition at line 260 of file Map3DGrid.h.
Referenced by AddPoint(), FindNearState(), GetHeight(), GetOpenGLCoord(), GetPointFromCoordinate(), Map3DGrid(), and OpenGLDraw().
|
private |
Definition at line 260 of file Map3DGrid.h.
Referenced by AddPoint(), AddSectorEdge(), FindNearState(), GetOpenGLCoord(), GetPointFromCoordinate(), GetWidth(), Map3DGrid(), OpenGLDraw(), and RemoveSectorEdge().
|
private |
Definition at line 261 of file Map3DGrid.h.
Referenced by GetSector(), GetXYFromState(), Map3DGrid(), and OpenGLDraw().
|
private |
Definition at line 261 of file Map3DGrid.h.
Referenced by Map3DGrid().
|
private |
Definition at line 262 of file Map3DGrid.h.
Referenced by AddEdge(), AddGridEdge(), AddPoint(), AddSectorEdge(), FindNearState(), GetAbstractionBytesUsed(), GetActions(), GetGridBytesUsed(), GetSuccessors(), GetXYZFromState(), InternalRemovePoint(), Map3DGrid(), OpenGLDraw(), PrintStats(), RemoveEdge(), RemoveGridEdge(), RemovePoint(), and RemoveSectorEdge().