Example #1
0
 private void removeAllChildren()
 {
     root.Destroy();
     root = new QuadNode <T>(root.X, root.Y, root.W, root.H, this);
 }
Example #2
0
 /// <summary>
 /// Instantiates a QuadTree instance
 /// </summary>
 /// <param name="_x">x-position of the quadtree</param>
 /// <param name="_y">y-position of the quadtree</param>
 /// <param name="_width">total width of the quadtree</param>
 /// <param name="_height">total height of the quadtree</param>
 /// <param name="_maxObjectsPerNode">number of objects a node can hold before it splits</param>
 /// <param name="_minNodeSideLength">minimum side-length of a node that can still split</param>
 public QuadTree(float _x, float _y, float _width, float _height, int _maxObjectsPerNode = 1, int _minNodeSideLength = 10)
 {
     MinNodeSideLength = _minNodeSideLength;
     MaxObjectsPerNode = _maxObjectsPerNode;
     root = new QuadNode <T>(_x, _y, _width, _height, this);
 }