7 namespace HybridAStar {
36 float getG()
const {
return g; }
38 float getH()
const {
return h; }
54 void setX(
const int&
x) { this->x =
x; }
56 void setY(
const int&
y) { this->y =
y; }
58 void setG(
const float&
g) { this->g =
g; }
60 void setH(
const float&
h) { this->h =
h; }
88 bool isOnGrid(
const int width,
const int height)
const;
98 static const int dx[];
100 static const int dy[];
int x
the x position
Definition: node2d.h:104
int getX() const
get the x position
Definition: node2d.h:32
void setG(const float &g)
set the cost-so-far (real value)
Definition: node2d.h:58
int getY() const
get the y position
Definition: node2d.h:34
float movementCost(const Node2D &pred) const
The heuristic as well as the cost measure.
Definition: node2d.h:80
int y
the y position
Definition: node2d.h:106
void open()
open the node
Definition: node2d.h:64
Node2D * getPred() const
get a pointer to the predecessor
Definition: node2d.h:50
This is a collection of constants that are used throughout the project.
static const int dx[]
Possible movements in the x direction.
Definition: node2d.h:98
float h
the cost-to-go
Definition: node2d.h:110
bool isOpen() const
determine whether the node is open
Definition: node2d.h:44
bool d
the discovered value
Definition: node2d.h:118
static const int dy[]
Possible movements in the y direction.
Definition: node2d.h:100
int setIdx(int width)
set and get the index of the node in the 2D array
Definition: node2d.h:62
int getIdx() const
get the index of the node in the 2D array
Definition: node2d.h:42
float g
the cost-so-far
Definition: node2d.h:108
float getH() const
get the cost-to-come (heuristic value)
Definition: node2d.h:38
bool c
the closed value
Definition: node2d.h:116
Node2D(int x, int y, float g, float h, Node2D *pred)
Constructor for a node with the given arguments.
Definition: node2d.h:19
static const int dir
Number of possible directions.
Definition: node2d.h:96
Node2D()
The default constructor for 2D array initialization.
Definition: node2d.h:17
void setX(const int &x)
set the x position
Definition: node2d.h:54
A two dimensional node class used for the holonomic with obstacles heuristic.
Definition: node2d.h:14
bool isClosed() const
determine whether the node is closed
Definition: node2d.h:46
void updateH(const Node2D &goal)
Updates the cost-to-go for the node x' to the goal node.
Definition: node2d.h:78
bool isDiscovered() const
determine whether the node is discovered
Definition: node2d.h:48
bool o
the open value
Definition: node2d.h:114
void reset()
set the node neither open nor closed
Definition: node2d.h:68
bool operator==(const Node2D &rhs) const
Custom operator to compare nodes. Nodes are equal if their x and y position is the same...
Definition: node2d.cpp:30
void setH(const float &h)
set the cost-to-come (heuristic value)
Definition: node2d.h:60
void setPred(Node2D *pred)
set a pointer to the predecessor of the node
Definition: node2d.h:72
void updateG()
Updates the cost-so-far for the node x' coming from its predecessor. It also discovers the node...
Definition: node2d.h:76
void setY(const int &y)
set the y position
Definition: node2d.h:56
void close()
close the node
Definition: node2d.h:66
float getC() const
get the total estimated cost
Definition: node2d.h:40
float getG() const
get the cost-so-far (real value)
Definition: node2d.h:36
bool isOnGrid(const int width, const int height) const
Validity check to test, whether the node is in the 2D array.
Definition: node2d.cpp:14
int idx
the index of the node in the 2D array
Definition: node2d.h:112
Node2D * createSuccessor(const int i)
Creates a successor on a eight-connected grid.
Definition: node2d.cpp:21
Node2D * pred
the predecessor pointer
Definition: node2d.h:120
void discover()
discover the node
Definition: node2d.h:70