Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
 QuadTreeNodeWrapper(QuadTreeNode <T> node) : base(null, 0, 0)
 {
     _node = node;
     _node.SetProperty("NodeWrapper", this);
 }
Exemplo n.º 3
0
 public QuadTree(int width, int height)
 {
     _node    = new QuadTreeNode <T>(0, 0, width, height);
     _objects = new List <T>();
 }