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

#include <VoxelGrid.h>

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

Public Member Functions

 VoxelGrid (int x, int y, int z)
 
 VoxelGrid (const char *filename)
 
 ~VoxelGrid ()
 
void And (VoxelGrid *g)
 
void Or (VoxelGrid *g)
 
void Save (const char *filename)
 
void SaveInMinBB (const char *filename)
 
void GetSuccessors (const voxelGridState &nodeID, std::vector< voxelGridState > &neighbors) const
 
void GetActions (const voxelGridState &nodeID, std::vector< voxelGridAction > &actions) const
 
void ApplyAction (voxelGridState &s, voxelGridAction a) const
 
bool InvertAction (voxelGridAction &a) const
 
double HCost (const voxelGridState &node1, const voxelGridState &node2) const
 Heuristic value between two arbitrary nodes. More...
 
double GCost (const voxelGridState &node1, const voxelGridState &node2) const
 
double GCost (const voxelGridState &node, const voxelGridAction &act) const
 
bool GoalTest (const voxelGridState &node, const voxelGridState &goal) const
 
uint64_t GetStateHash (const voxelGridState &node) const
 
void GetStateFromHash (uint64_t parent, voxelGridState &s)
 
uint64_t GetActionHash (voxelGridAction act) const
 
bool IsBlocked (const voxelGridState &s) const
 
bool IsBlocked (uint16_t x, uint16_t y, uint16_t z) const
 
void SetBlocked (const voxelGridState &s, bool block)
 
void SetBlocked (uint16_t x, uint16_t y, uint16_t z, bool block)
 
void GetLimits (int &x, int &y, int &z) const
 
bool Legal (const voxelGridState &s) const
 
bool CanMove (const voxelGridState &s1, const voxelGridState &s2) const
 
voxelGridState GetRandomState ()
 
void OpenGLDraw () const
 
void OpenGLDraw (const voxelGridState &) const
 
void OpenGLDraw (const voxelGridState &, const voxelGridState &, float) const
 Draw the transition at some percentage 0...1 between two states. More...
 
void OpenGLDraw (const voxelGridState &, const voxelGridAction &) const
 
void GLLabelState (const voxelGridState &, const char *) const
 
void GLDrawLine (const voxelGridState &x, const voxelGridState &y) const
 
void Draw (Graphics::Display &display) const
 
void GetGLCoordinate (const voxelGridState &, point3d &) const
 
void GetGLCornerCoordinate (const voxelGridState &, point3d &) const
 
void Fill (voxelGridState)
 
void Invert ()
 
BitMapPicGetImage (int face)
 
void SetUseEfficientDraw (bool e)
 
- Public Member Functions inherited from SearchEnvironment< voxelGridState, voxelGridAction >
virtual ~SearchEnvironment ()
 
virtual int GetNumSuccessors (const voxelGridState &stateID) const
 
virtual voxelGridAction GetAction (const voxelGridState &s1, const voxelGridState &s2) const
 
virtual void UndoAction (voxelGridState &s, voxelGridAction a) const
 
virtual void GetNextState (const voxelGridState &s1, voxelGridAction a, voxelGridState &s2) const
 
virtual void StoreGoal (voxelGridState &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 voxelGridState &node1, const voxelGridState &node2, double parentHCost) const
 
virtual double HCost (const voxelGridState &node) const
 Heuristic value between node and the stored goal. More...
 
virtual bool GoalTest (const voxelGridState &node) const
 Goal Test if the goal is stored. More...
 
virtual uint64_t GetMaxHash () const
 
virtual void GetStateFromHash (uint64_t parent, voxelGridState &s) const
 
virtual double GetPathLength (std::vector< voxelGridState > &neighbors)
 
virtual double GetPathLength (const voxelGridState &start, std::vector< voxelGridAction > &neighbors)
 
virtual OccupancyInterface< voxelGridState, voxelGridAction > * GetOccupancyInfo ()
 
virtual void SetOccupancyInfo (OccupancyInterface< voxelGridState, voxelGridAction > *)
 
virtual void OpenGLDraw () const
 
virtual void GLDrawPath (const std::vector< voxelGridState > &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 voxelGridState &) const
 
virtual void DrawLine (Graphics::Display &display, const voxelGridState &x, const voxelGridState &y, float width=1.0) const
 
- Public Member Functions inherited from Heuristic< voxelGridState >
 Heuristic ()
 
virtual ~Heuristic ()
 

Private Member Functions

void SetUpDrawBuffers ()
 
void EfficientDraw () const
 
void GetActionOffsets (voxelGridAction a, int &x, int &y, int &z) const
 
voxelGridAction MakeAction (int &x, int &y, int &z) const
 
int GetIndex (const voxelGridState &s) const
 
int GetIndex (int x, int y, int z) const
 
void GetCoordinates (int index, int &x, int &y, int &z) const
 
void GetCoordinates (int index, voxelGridState &s) const
 

Private Attributes

bool efficient
 
std::vector< bool > voxels
 
int xWidth
 
int yWidth
 
int zWidth
 
std::vector< GLfloat > vertices
 
std::vector< uint32_t > indices
 

Additional Inherited Members

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

Detailed Description

Definition at line 41 of file VoxelGrid.h.

Constructor & Destructor Documentation

◆ VoxelGrid() [1/2]

VoxelGrid::VoxelGrid ( int  x,
int  y,
int  z 
)

Definition at line 28 of file VoxelGrid.cpp.

References efficient, voxels, xWidth, yWidth, and zWidth.

◆ VoxelGrid() [2/2]

VoxelGrid::VoxelGrid ( const char *  filename)

Definition at line 37 of file VoxelGrid.cpp.

References efficient, GetIndex(), voxels, xWidth, yWidth, and zWidth.

◆ ~VoxelGrid()

VoxelGrid::~VoxelGrid ( )

Definition at line 63 of file VoxelGrid.cpp.

Member Function Documentation

◆ And()

void VoxelGrid::And ( VoxelGrid g)

Definition at line 68 of file VoxelGrid.cpp.

References IsBlocked(), SetBlocked(), xWidth, yWidth, and zWidth.

◆ ApplyAction()

void VoxelGrid::ApplyAction ( voxelGridState s,
voxelGridAction  a 
) const
virtual

◆ CanMove()

bool VoxelGrid::CanMove ( const voxelGridState s1,
const voxelGridState s2 
) const

Definition at line 213 of file VoxelGrid.cpp.

References IsBlocked(), voxelGridState::x, voxelGridState::y, and voxelGridState::z.

Referenced by GetActions(), and GetSuccessors().

◆ Draw()

void VoxelGrid::Draw ( Graphics::Display display) const
virtual

◆ EfficientDraw()

void VoxelGrid::EfficientDraw ( ) const
private

Definition at line 508 of file VoxelGrid.cpp.

References indices, and vertices.

Referenced by OpenGLDraw().

◆ Fill()

void VoxelGrid::Fill ( voxelGridState  s)

◆ GCost() [1/2]

double VoxelGrid::GCost ( const voxelGridState node,
const voxelGridAction act 
) const
virtual

◆ GCost() [2/2]

double VoxelGrid::GCost ( const voxelGridState node1,
const voxelGridState node2 
) const
virtual

◆ GetActionHash()

uint64_t VoxelGrid::GetActionHash ( voxelGridAction  act) const
virtual

◆ GetActionOffsets()

void VoxelGrid::GetActionOffsets ( voxelGridAction  a,
int &  x,
int &  y,
int &  z 
) const
private

Definition at line 257 of file VoxelGrid.cpp.

Referenced by ApplyAction().

◆ GetActions()

void VoxelGrid::GetActions ( const voxelGridState nodeID,
std::vector< voxelGridAction > &  actions 
) const
virtual

◆ GetCoordinates() [1/2]

void VoxelGrid::GetCoordinates ( int  index,
int &  x,
int &  y,
int &  z 
) const
private

Definition at line 200 of file VoxelGrid.cpp.

References xWidth, and zWidth.

◆ GetCoordinates() [2/2]

void VoxelGrid::GetCoordinates ( int  index,
voxelGridState s 
) const
private

Definition at line 192 of file VoxelGrid.cpp.

References voxelGridState::x, xWidth, voxelGridState::y, voxelGridState::z, and zWidth.

◆ GetGLCoordinate()

void VoxelGrid::GetGLCoordinate ( const voxelGridState v,
point3d p 
) const

Definition at line 430 of file VoxelGrid.cpp.

References max, voxelGridState::x, xWidth, voxelGridState::y, yWidth, voxelGridState::z, and zWidth.

Referenced by Draw(), GLDrawLine(), and OpenGLDraw().

◆ GetGLCornerCoordinate()

void VoxelGrid::GetGLCornerCoordinate ( const voxelGridState v,
point3d p 
) const

Definition at line 438 of file VoxelGrid.cpp.

References max, voxelGridState::x, xWidth, voxelGridState::y, yWidth, voxelGridState::z, and zWidth.

Referenced by SetUpDrawBuffers().

◆ GetImage()

BitMapPic * VoxelGrid::GetImage ( int  face)

◆ GetIndex() [1/2]

int VoxelGrid::GetIndex ( const voxelGridState s) const
private

◆ GetIndex() [2/2]

int VoxelGrid::GetIndex ( int  x,
int  y,
int  z 
) const
private

Definition at line 187 of file VoxelGrid.cpp.

References xWidth, and zWidth.

◆ GetLimits()

void VoxelGrid::GetLimits ( int &  x,
int &  y,
int &  z 
) const
inline

◆ GetRandomState()

voxelGridState VoxelGrid::GetRandomState ( )

◆ GetStateFromHash()

void VoxelGrid::GetStateFromHash ( uint64_t  parent,
voxelGridState s 
)

Definition at line 417 of file VoxelGrid.cpp.

References voxelGridState::x, voxelGridState::y, and voxelGridState::z.

◆ GetStateHash()

uint64_t VoxelGrid::GetStateHash ( const voxelGridState node) const
virtual

◆ GetSuccessors()

void VoxelGrid::GetSuccessors ( const voxelGridState nodeID,
std::vector< voxelGridState > &  neighbors 
) const
virtual

◆ GLDrawLine()

void VoxelGrid::GLDrawLine ( const voxelGridState x,
const voxelGridState y 
) const
virtual

Reimplemented from SearchEnvironment< voxelGridState, voxelGridAction >.

Definition at line 588 of file VoxelGrid.cpp.

References GetGLCoordinate(), and point3d.

◆ GLLabelState()

void VoxelGrid::GLLabelState ( const voxelGridState ,
const char *   
) const
virtual

Reimplemented from SearchEnvironment< voxelGridState, voxelGridAction >.

Definition at line 583 of file VoxelGrid.cpp.

◆ GoalTest()

bool VoxelGrid::GoalTest ( const voxelGridState node,
const voxelGridState goal 
) const
virtual

◆ HCost()

double VoxelGrid::HCost ( const voxelGridState node1,
const voxelGridState node2 
) const
virtual

Heuristic value between two arbitrary nodes.

Implements SearchEnvironment< voxelGridState, voxelGridAction >.

Definition at line 341 of file VoxelGrid.cpp.

References min(), ROOT_THREE, ROOT_TWO, voxelGridState::x, voxelGridState::y, and voxelGridState::z.

◆ Invert()

void VoxelGrid::Invert ( )

Definition at line 248 of file VoxelGrid.cpp.

References efficient, SetUpDrawBuffers(), and voxels.

◆ InvertAction()

bool VoxelGrid::InvertAction ( voxelGridAction a) const
virtual

◆ IsBlocked() [1/2]

bool VoxelGrid::IsBlocked ( const voxelGridState s) const

◆ IsBlocked() [2/2]

bool VoxelGrid::IsBlocked ( uint16_t  x,
uint16_t  y,
uint16_t  z 
) const
inline

Definition at line 68 of file VoxelGrid.h.

References IsBlocked().

◆ Legal()

bool VoxelGrid::Legal ( const voxelGridState s) const

Definition at line 208 of file VoxelGrid.cpp.

References voxelGridState::x, xWidth, voxelGridState::y, yWidth, voxelGridState::z, and zWidth.

◆ MakeAction()

voxelGridAction VoxelGrid::MakeAction ( int &  x,
int &  y,
int &  z 
) const
private

Definition at line 267 of file VoxelGrid.cpp.

Referenced by GetActions().

◆ OpenGLDraw() [1/4]

void VoxelGrid::OpenGLDraw ( ) const

◆ OpenGLDraw() [2/4]

void VoxelGrid::OpenGLDraw ( const voxelGridState ) const
virtual

Reimplemented from SearchEnvironment< voxelGridState, voxelGridAction >.

Definition at line 568 of file VoxelGrid.cpp.

◆ OpenGLDraw() [3/4]

void VoxelGrid::OpenGLDraw ( const voxelGridState ,
const voxelGridAction  
) const
virtual

Reimplemented from SearchEnvironment< voxelGridState, voxelGridAction >.

Definition at line 578 of file VoxelGrid.cpp.

◆ OpenGLDraw() [4/4]

void VoxelGrid::OpenGLDraw ( const voxelGridState ,
const voxelGridState ,
float   
) const
virtual

Draw the transition at some percentage 0...1 between two states.

Reimplemented from SearchEnvironment< voxelGridState, voxelGridAction >.

Definition at line 573 of file VoxelGrid.cpp.

◆ Or()

void VoxelGrid::Or ( VoxelGrid g)

Definition at line 82 of file VoxelGrid.cpp.

References IsBlocked(), SetBlocked(), xWidth, yWidth, and zWidth.

◆ Save()

void VoxelGrid::Save ( const char *  filename)

Definition at line 97 of file VoxelGrid.cpp.

References IsBlocked(), xWidth, yWidth, and zWidth.

◆ SaveInMinBB()

void VoxelGrid::SaveInMinBB ( const char *  filename)

Definition at line 120 of file VoxelGrid.cpp.

References IsBlocked(), max, min(), xWidth, yWidth, and zWidth.

◆ SetBlocked() [1/2]

void VoxelGrid::SetBlocked ( const voxelGridState s,
bool  block 
)

Definition at line 176 of file VoxelGrid.cpp.

References GetIndex(), voxels, voxelGridState::x, xWidth, voxelGridState::y, yWidth, voxelGridState::z, and zWidth.

Referenced by And(), Or(), and SetBlocked().

◆ SetBlocked() [2/2]

void VoxelGrid::SetBlocked ( uint16_t  x,
uint16_t  y,
uint16_t  z,
bool  block 
)
inline

Definition at line 71 of file VoxelGrid.h.

References SetBlocked().

◆ SetUpDrawBuffers()

void VoxelGrid::SetUpDrawBuffers ( )
private

◆ SetUseEfficientDraw()

void VoxelGrid::SetUseEfficientDraw ( bool  e)
inline

Definition at line 91 of file VoxelGrid.h.

References efficient, and SetUpDrawBuffers().

Member Data Documentation

◆ efficient

bool VoxelGrid::efficient
private

Definition at line 97 of file VoxelGrid.h.

Referenced by Fill(), Invert(), OpenGLDraw(), SetUseEfficientDraw(), and VoxelGrid().

◆ indices

std::vector<uint32_t> VoxelGrid::indices
private

Definition at line 110 of file VoxelGrid.h.

Referenced by EfficientDraw(), and SetUpDrawBuffers().

◆ vertices

std::vector<GLfloat> VoxelGrid::vertices
private

Definition at line 109 of file VoxelGrid.h.

Referenced by EfficientDraw(), and SetUpDrawBuffers().

◆ voxels

std::vector<bool> VoxelGrid::voxels
private

◆ xWidth

int VoxelGrid::xWidth
private

◆ yWidth

int VoxelGrid::yWidth
private

◆ zWidth

int VoxelGrid::zWidth
private

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