Panda3D
 All Classes Functions Variables Enumerations
meshNode.h
1 
2 #ifndef _MESHNODE_H
3 #define _MESHNODE_H
4 
5 #include "aiGlobals.h"
6 
7 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
8 //
9 // Class : Node
10 // Description : This class is used to assign the nodes on the mesh. It holds all the data necessary to
11 // compute A* algorithm. It also maintains a lot of vital information such as the neighbor
12 // nodes of each node and also its position on the mesh.
13 // Note: The Mesh Generator which is a stand alone tool makes use of this class to generate the nodes on the
14 // mesh.
15 
16 ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
17 
18 class EXPCL_PANDAAI Node {
19 public:
20  // This variable specifies whether the node is an obtacle or not.
21  // Used for dynamic obstacle addition to the environment.
22  // obstacle = false
23  // navigational = true
24  bool _type;
25 
26  // This variable specifies the node status whether open, close or neutral.
27  // open = belongs to _open_list.
28  // close = belongs to _closed_list.
29  // neutral = unexamined node.
30  enum Status {
31  open,
32  close,
33  neutral
34  };
35  Status _status;
36 
37  // The score is used to compute the traversal expense to nodes when using A*.
38  // _score = _cost + heuristic
39  int _score;
40  int _cost;
41  int _heuristic;
42 
43  // Used to trace back the path after it is generated using A*.
44  Node *_prv_node;
45 
46  // Position of the node in the 2d grid.
47  int _grid_x, _grid_y;
48 
49  // Position of the node in 3D space.
50  LVecBase3 _position;
51 
52  // Dimensions of each face / cell on the mesh.
53  // Height is given in case of expansion to a 3d mesh. Currently not used.
54  float _width, _length ,_height;
55  Node *_neighbours[8]; // anti-clockwise from top left corner.
56 
57  // The _next pointer is used for traversal during mesh generation from the model.
58  // Note: The data in this member is discarded when mesh data is written into navmesh.csv file.
59  Node *_next;
60 
61  Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h);
62  ~Node();
63 
64  bool contains(float x, float y);
65 };
66 
67 #endif
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
This class is used to assign the nodes on the mesh.
Definition: meshNode.h:18