A two dimensional node class used for the holonomic with obstacles heuristic. More...
#include <node2d.h>
Public Member Functions | |
Node2D () | |
The default constructor for 2D array initialization. | |
Node2D (int x, int y, float g, float h, Node2D *pred) | |
Constructor for a node with the given arguments. | |
int | getX () const |
get the x position | |
int | getY () const |
get the y position | |
float | getG () const |
get the cost-so-far (real value) | |
float | getH () const |
get the cost-to-come (heuristic value) | |
float | getC () const |
get the total estimated cost | |
int | getIdx () const |
get the index of the node in the 2D array | |
bool | isOpen () const |
determine whether the node is open | |
bool | isClosed () const |
determine whether the node is closed | |
bool | isDiscovered () const |
determine whether the node is discovered | |
Node2D * | getPred () const |
get a pointer to the predecessor | |
void | setX (const int &x) |
set the x position | |
void | setY (const int &y) |
set the y position | |
void | setG (const float &g) |
set the cost-so-far (real value) | |
void | setH (const float &h) |
set the cost-to-come (heuristic value) | |
int | setIdx (int width) |
set and get the index of the node in the 2D array | |
void | open () |
open the node | |
void | close () |
close the node | |
void | reset () |
set the node neither open nor closed | |
void | discover () |
discover the node | |
void | setPred (Node2D *pred) |
set a pointer to the predecessor of the node | |
void | updateG () |
Updates the cost-so-far for the node x' coming from its predecessor. It also discovers the node. | |
void | updateH (const Node2D &goal) |
Updates the cost-to-go for the node x' to the goal node. | |
float | movementCost (const Node2D &pred) const |
The heuristic as well as the cost measure. | |
bool | operator== (const Node2D &rhs) const |
Custom operator to compare nodes. Nodes are equal if their x and y position is the same. | |
bool | isOnGrid (const int width, const int height) const |
Validity check to test, whether the node is in the 2D array. | |
Node2D * | createSuccessor (const int i) |
Creates a successor on a eight-connected grid. | |
Static Public Attributes | |
static const int | dir = 8 |
Number of possible directions. | |
static const int | dx [] = { -1, -1, 0, 1, 1, 1, 0, -1 } |
Possible movements in the x direction. | |
static const int | dy [] = { 0, 1, 1, 1, 0, -1, -1, -1 } |
Possible movements in the y direction. | |
Private Attributes | |
int | x |
the x position | |
int | y |
the y position | |
float | g |
the cost-so-far | |
float | h |
the cost-to-go | |
int | idx |
the index of the node in the 2D array | |
bool | o |
the open value | |
bool | c |
the closed value | |
bool | d |
the discovered value | |
Node2D * | pred |
the predecessor pointer | |
A two dimensional node class used for the holonomic with obstacles heuristic.
Each node has a unique discrete position (x,y).