예제 #1
0
        public QuadTreeNode Get(WorldPosition worldPosition, double halfDim, int treeHeight, QuadTreeNode parent)
        {
            var tree = quadTrees.Count > 0 ? quadTrees.Pop() : new QuadTreeNode(this.quadTree, this, nodeCapacity, maxDepth);

            tree.SetUp(worldPosition, halfDim, treeHeight, parent);
            return(tree);
        }
예제 #2
0
 public void Return(QuadTreeNode tree) => quadTrees.Push(tree);
예제 #3
0
 public QuadTree(WorldPosition position, Size size, int poolSize, int nodeCapacity, int maxDepth)
 {
     pool     = new QuadTreePool(this, poolSize, nodeCapacity, maxDepth);
     RootNode = pool.Get(position, size.Width * 0.5, 0, null);
 }