QuadTreeNode <T> Neighbour(ESide direction) { QuadTreeNode <T> neighbor = null; // Ascent the tree up to a common ancestor. if (_parent != null && Adjacent(direction, Quadrant())) { neighbor = _parent.Neighbour(direction); } else { neighbor = _parent; } // Backtrack mirroring the ascending moves. if (neighbor != null && !neighbor.IsLeaf()) { return(neighbor.Child(Reflect(direction, Quadrant()))); } else { return(neighbor); } }
QuadTreeNodeWrapper(QuadTreeNode <T> node) : base(null, 0, 0) { _node = node; _node.SetProperty("NodeWrapper", this); }
public QuadTree(int width, int height) { _node = new QuadTreeNode <T>(0, 0, width, height); _objects = new List <T>(); }