HOG2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
DWG::DynamicWeightedGridEnvironment Class Reference

#include <DynamicWeightedGrid.h>

Inheritance diagram for DWG::DynamicWeightedGridEnvironment:
Inheritance graph
[legend]
Collaboration diagram for DWG::DynamicWeightedGridEnvironment:
Collaboration graph
[legend]

Public Member Functions

 DynamicWeightedGridEnvironment (const char *map)
 
 DynamicWeightedGridEnvironment (int width, int height)
 
void GetSuccessors (const xyLoc &nodeID, std::vector< xyLoc > &neighbors) const
 
void GetActions (const xyLoc &nodeID, std::vector< tDirection > &actions) const
 
void ApplyAction (xyLoc &s, tDirection a) const
 
bool InvertAction (tDirection &a) const
 
tDirection GetAction (const xyLoc &s1, const xyLoc &s2) const
 
double HCost (const xyLoc &node1, const xyLoc &node2) const
 Heuristic value between two arbitrary nodes. More...
 
double GCost (const xyLoc &node1, const xyLoc &node2) const
 
double GCost (const xyLoc &node, const tDirection &act) const
 
bool GoalTest (const xyLoc &node, const xyLoc &goal) const
 
uint64_t GetStateHash (const xyLoc &node) const
 
uint64_t GetMaxHash () const
 
uint64_t GetActionHash (tDirection act) const
 
void Draw (Graphics::Display &display) const
 
void Draw (Graphics::Display &display, const xyLoc &) const
 
void OpenGLDraw () const
 
void OpenGLDraw (const xyLoc &) const
 
void OpenGLDraw (const xyLoc &, const tDirection &) const
 
void GLDrawLine (const xyLoc &x, const xyLoc &y) const
 
void SetCosts (std::vector< double > &c)
 
void SetCost (TerrainType t, double cost)
 
std::vector< double > & GetCosts ()
 
void SetTerrainType (const xyLoc &l, TerrainType t)
 
- 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 void GetNextState (const xyLoc &s1, tDirection a, xyLoc &s2) const
 
virtual void StoreGoal (xyLoc &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 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 bool GoalTest (const xyLoc &node) const
 Goal Test if the goal is stored. More...
 
virtual uint64_t GetMaxHash () const
 
virtual void GetStateFromHash (uint64_t parent, xyLoc &s) const
 
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 xyLoc &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
virtual void GLLabelState (const xyLoc &, const char *) 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 ()
 

Private Member Functions

void GetCoordinate (const xyLoc &l, float &x, float &y, float &r) const
 

Private Attributes

std::vector< double > costs
 
std::vector< uint8_t > terrain
 
int mWidth
 
int mHeight
 

Additional Inherited Members

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

Detailed Description

Definition at line 211 of file DynamicWeightedGrid.h.

Constructor & Destructor Documentation

◆ DynamicWeightedGridEnvironment() [1/2]

DWG::DynamicWeightedGridEnvironment::DynamicWeightedGridEnvironment ( const char *  map)

Definition at line 17 of file DynamicWeightedGrid.cpp.

References mHeight, mWidth, and terrain.

◆ DynamicWeightedGridEnvironment() [2/2]

DWG::DynamicWeightedGridEnvironment::DynamicWeightedGridEnvironment ( int  width,
int  height 
)

Definition at line 54 of file DynamicWeightedGrid.cpp.

References height, DWG::kGround, mHeight, mWidth, terrain, and width.

Member Function Documentation

◆ ApplyAction()

void DWG::DynamicWeightedGridEnvironment::ApplyAction ( xyLoc s,
tDirection  a 
) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 163 of file DynamicWeightedGrid.cpp.

References kE, kN, kNE, kNW, kS, kSE, kSW, kW, xyLoc::x, and xyLoc::y.

Referenced by GCost().

◆ Draw() [1/2]

void DWG::DynamicWeightedGridEnvironment::Draw ( Graphics::Display display) const
virtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 248 of file DynamicWeightedGrid.cpp.

◆ Draw() [2/2]

void DWG::DynamicWeightedGridEnvironment::Draw ( Graphics::Display display,
const xyLoc l 
) const
virtual

◆ GCost() [1/2]

double DWG::DynamicWeightedGridEnvironment::GCost ( const xyLoc node,
const tDirection act 
) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 226 of file DynamicWeightedGrid.cpp.

References ApplyAction(), and GCost().

◆ GCost() [2/2]

double DWG::DynamicWeightedGridEnvironment::GCost ( const xyLoc node1,
const xyLoc node2 
) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 215 of file DynamicWeightedGrid.cpp.

References mWidth, terrain, xyLoc::x, and xyLoc::y.

Referenced by GCost().

◆ GetAction()

tDirection DWG::DynamicWeightedGridEnvironment::GetAction ( const xyLoc s1,
const xyLoc s2 
) const
virtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 196 of file DynamicWeightedGrid.cpp.

◆ GetActionHash()

uint64_t DWG::DynamicWeightedGridEnvironment::GetActionHash ( tDirection  act) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 243 of file DynamicWeightedGrid.cpp.

◆ GetActions()

void DWG::DynamicWeightedGridEnvironment::GetActions ( const xyLoc nodeID,
std::vector< tDirection > &  actions 
) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 125 of file DynamicWeightedGrid.cpp.

References kE, kN, kNE, kNW, kS, kSE, kSW, kW, mHeight, mWidth, xyLoc::x, and xyLoc::y.

◆ GetCoordinate()

void DWG::DynamicWeightedGridEnvironment::GetCoordinate ( const xyLoc l,
float &  x,
float &  y,
float &  r 
) const
private

Definition at line 261 of file DynamicWeightedGrid.cpp.

References mHeight, mWidth, xyLoc::x, and xyLoc::y.

Referenced by Draw().

◆ GetCosts()

std::vector<double>& DWG::DynamicWeightedGridEnvironment::GetCosts ( )
inline

Definition at line 244 of file DynamicWeightedGrid.h.

References costs.

◆ GetMaxHash()

uint64_t DWG::DynamicWeightedGridEnvironment::GetMaxHash ( ) const
inline

Definition at line 227 of file DynamicWeightedGrid.h.

References mHeight, and mWidth.

◆ GetStateHash()

uint64_t DWG::DynamicWeightedGridEnvironment::GetStateHash ( const xyLoc node) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 238 of file DynamicWeightedGrid.cpp.

References mWidth.

◆ GetSuccessors()

void DWG::DynamicWeightedGridEnvironment::GetSuccessors ( const xyLoc nodeID,
std::vector< xyLoc > &  neighbors 
) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 76 of file DynamicWeightedGrid.cpp.

References mHeight, mWidth, xyLoc::x, and xyLoc::y.

◆ GLDrawLine()

void DWG::DynamicWeightedGridEnvironment::GLDrawLine ( const xyLoc x,
const xyLoc y 
) const
inlinevirtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 235 of file DynamicWeightedGrid.h.

◆ GoalTest()

bool DWG::DynamicWeightedGridEnvironment::GoalTest ( const xyLoc node,
const xyLoc goal 
) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 233 of file DynamicWeightedGrid.cpp.

◆ HCost()

double DWG::DynamicWeightedGridEnvironment::HCost ( const xyLoc node1,
const xyLoc node2 
) const
virtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 204 of file DynamicWeightedGrid.cpp.

References xyLoc::x, and xyLoc::y.

◆ InvertAction()

bool DWG::DynamicWeightedGridEnvironment::InvertAction ( tDirection a) const
virtual

Implements SearchEnvironment< xyLoc, tDirection >.

Definition at line 179 of file DynamicWeightedGrid.cpp.

References kE, kN, kNE, kNW, kS, kSE, kSW, and kW.

◆ OpenGLDraw() [1/3]

void DWG::DynamicWeightedGridEnvironment::OpenGLDraw ( ) const
inline

Definition at line 232 of file DynamicWeightedGrid.h.

◆ OpenGLDraw() [2/3]

void DWG::DynamicWeightedGridEnvironment::OpenGLDraw ( const xyLoc ) const
inlinevirtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 233 of file DynamicWeightedGrid.h.

◆ OpenGLDraw() [3/3]

void DWG::DynamicWeightedGridEnvironment::OpenGLDraw ( const xyLoc ,
const tDirection  
) const
inlinevirtual

Reimplemented from SearchEnvironment< xyLoc, tDirection >.

Definition at line 234 of file DynamicWeightedGrid.h.

◆ SetCost()

void DWG::DynamicWeightedGridEnvironment::SetCost ( TerrainType  t,
double  cost 
)
inline

Definition at line 240 of file DynamicWeightedGrid.h.

◆ SetCosts()

void DWG::DynamicWeightedGridEnvironment::SetCosts ( std::vector< double > &  c)
inline

Definition at line 236 of file DynamicWeightedGrid.h.

◆ SetTerrainType()

void DWG::DynamicWeightedGridEnvironment::SetTerrainType ( const xyLoc l,
TerrainType  t 
)
inline

Definition at line 248 of file DynamicWeightedGrid.h.

References mWidth, terrain, xyLoc::x, and xyLoc::y.

Member Data Documentation

◆ costs

std::vector<double> DWG::DynamicWeightedGridEnvironment::costs
private

Definition at line 254 of file DynamicWeightedGrid.h.

Referenced by GetCosts().

◆ mHeight

int DWG::DynamicWeightedGridEnvironment::mHeight
private

◆ mWidth

int DWG::DynamicWeightedGridEnvironment::mWidth
private

◆ terrain

std::vector<uint8_t> DWG::DynamicWeightedGridEnvironment::terrain
private

Definition at line 255 of file DynamicWeightedGrid.h.

Referenced by DynamicWeightedGridEnvironment(), GCost(), and SetTerrainType().


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