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