Panda3D
meshNode.cxx
1 
2 #include "meshNode.h"
3 
4 Node::Node(int grid_x, int grid_y, LVecBase3 pos, float w, float l, float h) {
5  for(int i = 0; i < 8; ++i) {
6  _neighbours[i] = nullptr;
7  }
8 
9  _position = pos;
10  _width = w;
11  _length = l;
12  _height = h;
13  _grid_x = grid_x;
14  _grid_y = grid_y;
15  _status = neutral;
16  _type = true;
17  _score = 0;
18  _cost = 0;
19  _heuristic = 0;
20  _next = nullptr;
21  _prv_node = nullptr;
22 }
23 
24 Node::~Node() {
25 }
26 
27 /**
28  * This is a handy function which returns true if the passed position is
29  * within the node's dimensions.
30  */
31 bool Node::contains(float x, float y) {
32  if(_position.get_x() - _width / 2 <= x && _position.get_x() + _width / 2 >= x &&
33  _position.get_y() - _length / 2 <= y && _position.get_y() + _length / 2 >= y) {
34  return true;
35  }
36  else {
37  return false;
38  }
39 }
bool contains(float x, float y)
This is a handy function which returns true if the passed position is within the node's dimensions.
Definition: meshNode.cxx:31