Exemplo n.º 1
0
 public void Add(aabb2 bound, object value)
 {
     if (root == null)
     {
         root = new BVHTreeNode2(bound, value);
     }
 }
Exemplo n.º 2
0
        protected BVHTreeNode2 FindNode(aabb2 bound)
        {
            Stack <BVHTreeNode2> stack = new Stack <BVHTreeNode2>();

            stack.Push(root);

            BVHTreeNode2 lastNode = null;

            while (stack.Count > 0)
            {
                var node = stack.Pop();

                var res = node.bound.intersect(bound);
                if (res == IntersectResult.None)
                {
                    continue;
                }
                if (res == IntersectResult.Contain1)
                {
                    lastNode = node;
                    stack.Push(node.a);
                    stack.Push(node.b);
                }
            }

            return(lastNode);
        }