HOG2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Map3DGrid Class Reference

#include <Map3DGrid.h>

Inheritance diagram for Map3DGrid:
Inheritance graph
[legend]
Collaboration diagram for Map3DGrid:
Collaboration graph
[legend]

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< SectorDatasectors
 
bool drawGrid
 

Additional Inherited Members

- Public Attributes inherited from Heuristic< state3d >
std::vector< HeuristicTreeNodelookups
 
std::vector< Heuristic * > heuristics
 
uint64_t histogram [256]
 
- Protected Attributes inherited from SearchEnvironment< state3d, action3d >
bool bValidSearchGoal
 
state3d searchGoal
 
rgbColor color
 
GLfloat transparency
 

Detailed Description

Definition at line 200 of file Map3DGrid.h.

Constructor & Destructor Documentation

◆ Map3DGrid() [1/2]

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() [2/2]

Map3DGrid::Map3DGrid ( Map map,
int  theSectorSize 
)

Member Function Documentation

◆ AddEdge() [1/2]

void Map3DGrid::AddEdge ( int  sec1,
int  reg1,
int  sec2,
int  reg2,
int  weight 
)
private

Definition at line 1016 of file Map3DGrid.cpp.

References sectors.

◆ AddEdge() [2/2]

void Map3DGrid::AddEdge ( state3d from,
state3d to 
)
private

◆ AddGridEdge()

int Map3DGrid::AddGridEdge ( state3d from,
state3d to,
bool  local 
)
private

◆ AddMap()

void Map3DGrid::AddMap ( Map map,
int  elevation 
)

◆ AddMapPoints()

void Map3DGrid::AddMapPoints ( Map map,
std::vector< bool > &  visited,
int  x,
int  y,
int  elevation 
)
private

Definition at line 483 of file Map3DGrid.cpp.

References AddPoint(), Map::GetMapWidth(), GetSector(), Map::GetTerrainType(), kGround, and terrainBits.

Referenced by AddMap().

◆ AddPoint()

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().

◆ AddSectorEdge()

int Map3DGrid::AddSectorEdge ( state3d from,
state3d to 
)
private

◆ ApplyAction()

void Map3DGrid::ApplyAction ( state3d s,
action3d  a 
) const
virtual

◆ FindNearState()

int Map3DGrid::FindNearState ( int  x,
int  y,
int  z,
state3d s 
) const

◆ GCost() [1/2]

double Map3DGrid::GCost ( const state3d node,
const action3d act 
) const
virtual

Implements SearchEnvironment< state3d, action3d >.

Definition at line 843 of file Map3DGrid.cpp.

◆ GCost() [2/2]

double Map3DGrid::GCost ( const state3d node1,
const state3d node2 
) const
virtual

Implements SearchEnvironment< state3d, action3d >.

Definition at line 837 of file Map3DGrid.cpp.

◆ GetAbstractionBytesUsed()

int Map3DGrid::GetAbstractionBytesUsed ( )

Definition at line 1625 of file Map3DGrid.cpp.

References sectors.

◆ GetAction()

action3d Map3DGrid::GetAction ( const state3d s1,
const state3d s2 
) const
inlinevirtual

Reimplemented from SearchEnvironment< state3d, action3d >.

Definition at line 215 of file Map3DGrid.h.

◆ GetActionHash()

uint64_t Map3DGrid::GetActionHash ( action3d  act) const
virtual

Implements SearchEnvironment< state3d, action3d >.

Definition at line 861 of file Map3DGrid.cpp.

◆ GetActions()

void Map3DGrid::GetActions ( const state3d nodeID,
std::vector< action3d > &  actions 
) const
virtual

◆ GetDrawGrid()

bool Map3DGrid::GetDrawGrid ( )
inline

Definition at line 236 of file Map3DGrid.h.

References drawGrid.

◆ GetGridBytesUsed()

int Map3DGrid::GetGridBytesUsed ( )

Definition at line 1638 of file Map3DGrid.cpp.

References gSectorSize, and sectors.

◆ GetHeight()

int Map3DGrid::GetHeight ( )
inline

Definition at line 205 of file Map3DGrid.h.

References mHeight.

◆ GetOpenGLCoord()

void Map3DGrid::GetOpenGLCoord ( int  xLoc,
int  yLoc,
int  zLoc,
GLdouble &  x,
GLdouble &  y,
GLdouble &  z,
GLdouble &  r,
GLdouble &  h 
) const
private

Definition at line 1591 of file Map3DGrid.cpp.

References max, mHeight, and mWidth.

Referenced by GLDrawLine(), and OpenGLDraw().

◆ GetPointFromCoordinate()

void Map3DGrid::GetPointFromCoordinate ( point3d  loc,
int &  px,
int &  py,
int &  pz 
) const

Definition at line 1429 of file Map3DGrid.cpp.

References max, mHeight, mWidth, loc::x, and loc::y.

◆ GetSector()

int Map3DGrid::GetSector ( int  x,
int  y 
) const
inlineprivate

Definition at line 253 of file Map3DGrid.h.

References gSectorSize, and mXSectors.

Referenced by AddMapPoints(), AddPoint(), FindNearState(), InternalRemovePoint(), and RemovePoint().

◆ GetStateFromXYZ()

void Map3DGrid::GetStateFromXYZ ( state3d s,
int  x,
int  y,
int  z 
) const
private

Definition at line 1418 of file Map3DGrid.cpp.

References FindNearState().

Referenced by ApplyAction(), and GetSuccessors().

◆ GetStateHash()

uint64_t Map3DGrid::GetStateHash ( const state3d node) const
virtual

Implements SearchEnvironment< state3d, action3d >.

Definition at line 855 of file Map3DGrid.cpp.

◆ GetSuccessors()

void Map3DGrid::GetSuccessors ( const state3d nodeID,
std::vector< state3d > &  neighbors 
) const
virtual

◆ GetWidth()

int Map3DGrid::GetWidth ( )
inline

Definition at line 204 of file Map3DGrid.h.

References mWidth.

◆ GetXYFromState()

void Map3DGrid::GetXYFromState ( const state3d s,
int &  x,
int &  y 
) const
private

◆ GetXYZFromState()

void Map3DGrid::GetXYZFromState ( const state3d s,
int &  x,
int &  y,
int &  z 
) const
private

◆ GLDrawLine()

void Map3DGrid::GLDrawLine ( const state3d x,
const state3d y 
) const
virtual

◆ GoalTest()

bool Map3DGrid::GoalTest ( const state3d node,
const state3d goal 
) const
virtual

Implements SearchEnvironment< state3d, action3d >.

Definition at line 849 of file Map3DGrid.cpp.

◆ HCost()

double Map3DGrid::HCost ( const state3d node1,
const state3d node2 
) const
virtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< state3d, action3d >.

Definition at line 831 of file Map3DGrid.cpp.

◆ InternalRemovePoint()

int Map3DGrid::InternalRemovePoint ( int  x,
int  y,
int  z 
)
private

◆ InvertAction()

bool Map3DGrid::InvertAction ( action3d a) const
inlinevirtual

Implements SearchEnvironment< state3d, action3d >.

Definition at line 214 of file Map3DGrid.h.

◆ OpenGLDraw() [1/3]

void Map3DGrid::OpenGLDraw ( ) const

◆ OpenGLDraw() [2/3]

void Map3DGrid::OpenGLDraw ( const state3d s) const
virtual

Reimplemented from SearchEnvironment< state3d, action3d >.

Definition at line 1560 of file Map3DGrid.cpp.

◆ OpenGLDraw() [3/3]

void Map3DGrid::OpenGLDraw ( const state3d ,
const action3d  
) const
inlinevirtual

Reimplemented from SearchEnvironment< state3d, action3d >.

Definition at line 229 of file Map3DGrid.h.

◆ PrintStats()

void Map3DGrid::PrintStats ( )

Definition at line 1606 of file Map3DGrid.cpp.

References sectors.

◆ RemoveEdge() [1/2]

void Map3DGrid::RemoveEdge ( int  sec1,
int  reg1,
int  sec2,
int  reg2,
int  weight 
)
private

Definition at line 1271 of file Map3DGrid.cpp.

References sectors.

Referenced by InternalRemovePoint(), and RemoveEdge().

◆ RemoveEdge() [2/2]

void Map3DGrid::RemoveEdge ( state3d from,
state3d to 
)
private

◆ RemoveGridEdge()

int Map3DGrid::RemoveGridEdge ( state3d from,
state3d to 
)
private

◆ RemovePoint()

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().

◆ RemoveSectorEdge()

int Map3DGrid::RemoveSectorEdge ( state3d from,
state3d to 
)
private

◆ SetDrawGrid()

void Map3DGrid::SetDrawGrid ( bool  draw)
inline

Definition at line 235 of file Map3DGrid.h.

References drawGrid.

Member Data Documentation

◆ drawGrid

bool Map3DGrid::drawGrid
private

Definition at line 263 of file Map3DGrid.h.

Referenced by GetDrawGrid(), Map3DGrid(), OpenGLDraw(), and SetDrawGrid().

◆ mHeight

int Map3DGrid::mHeight
private

◆ mWidth

int Map3DGrid::mWidth
private

◆ mXSectors

int Map3DGrid::mXSectors
private

Definition at line 261 of file Map3DGrid.h.

Referenced by GetSector(), GetXYFromState(), Map3DGrid(), and OpenGLDraw().

◆ mYSectors

int Map3DGrid::mYSectors
private

Definition at line 261 of file Map3DGrid.h.

Referenced by Map3DGrid().

◆ sectors

std::vector<SectorData> Map3DGrid::sectors
private

The documentation for this class was generated from the following files: