HOG2
|
#include <VoxelGrid.h>
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 () |
BitMapPic * | GetImage (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< HeuristicTreeNode > | lookups |
std::vector< Heuristic * > | heuristics |
uint64_t | histogram [256] |
Protected Attributes inherited from SearchEnvironment< voxelGridState, voxelGridAction > | |
bool | bValidSearchGoal |
voxelGridState | searchGoal |
rgbColor | color |
GLfloat | transparency |
Definition at line 41 of file VoxelGrid.h.
VoxelGrid::VoxelGrid | ( | int | x, |
int | y, | ||
int | z | ||
) |
VoxelGrid::VoxelGrid | ( | const char * | filename | ) |
Definition at line 37 of file VoxelGrid.cpp.
References efficient, GetIndex(), voxels, xWidth, yWidth, and zWidth.
VoxelGrid::~VoxelGrid | ( | ) |
Definition at line 63 of file VoxelGrid.cpp.
void VoxelGrid::And | ( | VoxelGrid * | g | ) |
Definition at line 68 of file VoxelGrid.cpp.
References IsBlocked(), SetBlocked(), xWidth, yWidth, and zWidth.
|
virtual |
Implements SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 325 of file VoxelGrid.cpp.
References GetActionOffsets(), voxelGridState::x, voxelGridState::y, and voxelGridState::z.
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().
|
virtual |
Reimplemented from SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 599 of file VoxelGrid.cpp.
References rgbColor::b, Graphics::Display::FillRect(), rgbColor::g, GetGLCoordinate(), GetIndex(), max, min(), point3d, rgbColor::r, voxels, Colors::white, xWidth, yWidth, and zWidth.
|
private |
Definition at line 508 of file VoxelGrid.cpp.
References indices, and vertices.
Referenced by OpenGLDraw().
void VoxelGrid::Fill | ( | voxelGridState | s | ) |
Definition at line 225 of file VoxelGrid.cpp.
References efficient, GetIndex(), IsBlocked(), SetUpDrawBuffers(), voxels, voxelGridState::x, voxelGridState::y, and voxelGridState::z.
|
virtual |
Implements SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 388 of file VoxelGrid.cpp.
|
virtual |
Implements SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 375 of file VoxelGrid.cpp.
References ROOT_THREE, ROOT_TWO, voxelGridState::x, voxelGridState::y, and voxelGridState::z.
|
virtual |
Implements SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 425 of file VoxelGrid.cpp.
|
private |
Definition at line 257 of file VoxelGrid.cpp.
Referenced by ApplyAction().
|
virtual |
Implements SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 301 of file VoxelGrid.cpp.
References CanMove(), GetIndex(), MakeAction(), voxels, voxelGridState::x, voxelGridState::y, and voxelGridState::z.
|
private |
Definition at line 200 of file VoxelGrid.cpp.
|
private |
Definition at line 192 of file VoxelGrid.cpp.
References voxelGridState::x, xWidth, voxelGridState::y, voxelGridState::z, and zWidth.
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().
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().
BitMapPic * VoxelGrid::GetImage | ( | int | face | ) |
Definition at line 650 of file VoxelGrid.cpp.
References rgbColor::b, rgbColor::g, GetIndex(), max, min(), rgbColor::r, BitMapPic::SetPixel(), voxels, xWidth, yWidth, and zWidth.
|
private |
Definition at line 182 of file VoxelGrid.cpp.
References voxelGridState::x, voxelGridState::y, and voxelGridState::z.
Referenced by Draw(), Fill(), GetActions(), GetImage(), GetRandomState(), GetSuccessors(), IsBlocked(), OpenGLDraw(), SetBlocked(), and VoxelGrid().
|
private |
Definition at line 187 of file VoxelGrid.cpp.
|
inline |
Definition at line 73 of file VoxelGrid.h.
References xWidth, yWidth, and zWidth.
Referenced by VoxelUtils::AddNXFace(), VoxelUtils::AddNYFace(), VoxelUtils::AddNZFace(), VoxelUtils::AddPXFace(), VoxelUtils::AddPYFace(), VoxelUtils::AddPZFace(), and VoxelUtils::GetTriangles().
voxelGridState VoxelGrid::GetRandomState | ( | ) |
Definition at line 400 of file VoxelGrid.cpp.
References GetIndex(), voxels, voxelGridState::x, xWidth, voxelGridState::y, yWidth, voxelGridState::z, and zWidth.
void VoxelGrid::GetStateFromHash | ( | uint64_t | parent, |
voxelGridState & | s | ||
) |
Definition at line 417 of file VoxelGrid.cpp.
References voxelGridState::x, voxelGridState::y, and voxelGridState::z.
|
virtual |
Implements SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 412 of file VoxelGrid.cpp.
|
virtual |
Implements SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 277 of file VoxelGrid.cpp.
References CanMove(), GetIndex(), voxels, voxelGridState::x, voxelGridState::y, and voxelGridState::z.
|
virtual |
Reimplemented from SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 588 of file VoxelGrid.cpp.
References GetGLCoordinate(), and point3d.
|
virtual |
Reimplemented from SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 583 of file VoxelGrid.cpp.
|
virtual |
Implements SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 394 of file VoxelGrid.cpp.
|
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.
void VoxelGrid::Invert | ( | ) |
Definition at line 248 of file VoxelGrid.cpp.
References efficient, SetUpDrawBuffers(), and voxels.
|
virtual |
Implements SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 334 of file VoxelGrid.cpp.
bool VoxelGrid::IsBlocked | ( | const voxelGridState & | s | ) | const |
Definition at line 169 of file VoxelGrid.cpp.
References GetIndex(), voxels, voxelGridState::x, xWidth, voxelGridState::y, yWidth, voxelGridState::z, and zWidth.
Referenced by And(), CanMove(), Fill(), IsBlocked(), Or(), Save(), SaveInMinBB(), VoxelUtils::XMaxRect(), VoxelUtils::XMaxSquare(), VoxelUtils::YMaxRect(), VoxelUtils::YMaxSquare(), VoxelUtils::ZMaxRect(), and VoxelUtils::ZMaxSquare().
|
inline |
Definition at line 68 of file VoxelGrid.h.
References IsBlocked().
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.
|
private |
Definition at line 267 of file VoxelGrid.cpp.
Referenced by GetActions().
void VoxelGrid::OpenGLDraw | ( | ) | const |
Definition at line 529 of file VoxelGrid.cpp.
References rgbColor::b, DrawBox(), efficient, EfficientDraw(), rgbColor::g, Colors::GetColor(), GetGLCoordinate(), GetIndex(), max, point3d, rgbColor::r, voxels, xWidth, yWidth, and zWidth.
|
virtual |
Reimplemented from SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 568 of file VoxelGrid.cpp.
|
virtual |
Reimplemented from SearchEnvironment< voxelGridState, voxelGridAction >.
Definition at line 578 of file VoxelGrid.cpp.
|
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.
void VoxelGrid::Or | ( | VoxelGrid * | g | ) |
Definition at line 82 of file VoxelGrid.cpp.
References IsBlocked(), SetBlocked(), xWidth, yWidth, and zWidth.
void VoxelGrid::Save | ( | const char * | filename | ) |
Definition at line 97 of file VoxelGrid.cpp.
References IsBlocked(), xWidth, yWidth, and zWidth.
void VoxelGrid::SaveInMinBB | ( | const char * | filename | ) |
Definition at line 120 of file VoxelGrid.cpp.
References IsBlocked(), max, min(), xWidth, yWidth, and zWidth.
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().
|
inline |
Definition at line 71 of file VoxelGrid.h.
References SetBlocked().
|
private |
Definition at line 447 of file VoxelGrid.cpp.
References GetGLCornerCoordinate(), VoxelUtils::GetTriangles(), indices, max, VoxelUtils::vn::normal, point3d, VoxelUtils::vn::v, vertices, xWidth, yWidth, and zWidth.
Referenced by Fill(), Invert(), and SetUseEfficientDraw().
|
inline |
Definition at line 91 of file VoxelGrid.h.
References efficient, and SetUpDrawBuffers().
|
private |
Definition at line 97 of file VoxelGrid.h.
Referenced by Fill(), Invert(), OpenGLDraw(), SetUseEfficientDraw(), and VoxelGrid().
|
private |
Definition at line 110 of file VoxelGrid.h.
Referenced by EfficientDraw(), and SetUpDrawBuffers().
|
private |
Definition at line 109 of file VoxelGrid.h.
Referenced by EfficientDraw(), and SetUpDrawBuffers().
|
private |
Definition at line 107 of file VoxelGrid.h.
Referenced by Draw(), Fill(), GetActions(), GetImage(), GetRandomState(), GetSuccessors(), Invert(), IsBlocked(), OpenGLDraw(), SetBlocked(), and VoxelGrid().
|
private |
Definition at line 108 of file VoxelGrid.h.
Referenced by And(), Draw(), GetCoordinates(), GetGLCoordinate(), GetGLCornerCoordinate(), GetImage(), GetIndex(), GetLimits(), GetRandomState(), IsBlocked(), Legal(), OpenGLDraw(), Or(), Save(), SaveInMinBB(), SetBlocked(), SetUpDrawBuffers(), and VoxelGrid().
|
private |
Definition at line 108 of file VoxelGrid.h.
Referenced by And(), Draw(), GetGLCoordinate(), GetGLCornerCoordinate(), GetImage(), GetLimits(), GetRandomState(), IsBlocked(), Legal(), OpenGLDraw(), Or(), Save(), SaveInMinBB(), SetBlocked(), SetUpDrawBuffers(), and VoxelGrid().
|
private |
Definition at line 108 of file VoxelGrid.h.
Referenced by And(), Draw(), GetCoordinates(), GetGLCoordinate(), GetGLCornerCoordinate(), GetImage(), GetIndex(), GetLimits(), GetRandomState(), IsBlocked(), Legal(), OpenGLDraw(), Or(), Save(), SaveInMinBB(), SetBlocked(), SetUpDrawBuffers(), and VoxelGrid().