Beispiel #1
0
        public void query(TreeCallback callback, AABB aabb)
        {
            nodeStack.reset();
            nodeStack.push(m_root);

            while (nodeStack.getCount() > 0)
            {
                DynamicTreeNode node = nodeStack.pop();
                if (node == null)
                {
                    continue;
                }

                if (AABB.testOverlap(node.aabb, aabb))
                {
                    if (node.child1 == null)
                    {
                        bool proceed = callback.treeCallback(node.id);
                        if (!proceed)
                        {
                            return;
                        }
                    }
                    else
                    {
                        nodeStack.push(node.child1);
                        nodeStack.push(node.child2);
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Query an AABB for overlapping proxies. The callback class is called for each proxy that
        /// overlaps the supplied AABB.
        /// </summary>
        /// <param name="callback"></param>
        /// <param name="araabbgAABB"></param>
        public void query(TreeCallback callback, AABB aabb)
        {
            intStack.reset();
            intStack.push(m_root);

            while (intStack.Count > 0)
            {
                int nodeId = intStack.pop();
                if (nodeId == TreeNode.NULL_NODE)
                {
                    continue;
                }

                TreeNode node = m_nodes[nodeId];

                if (AABB.testOverlap(node.aabb, aabb))
                {
                    if (node.Leaf)
                    {
                        bool proceed = callback.treeCallback(nodeId);
                        if (!proceed)
                        {
                            return;
                        }
                    }
                    else
                    {
                        intStack.push(node.child1);
                        intStack.push(node.child2);
                    }
                }
            }
        }
 public void query(TreeCallback callback, AABB aabb)
 {
     m_tree.query(callback, aabb);
 }
Beispiel #4
0
        /**
         * Query an AABB for overlapping proxies. The callback class is called for each proxy that
         * overlaps the supplied AABB.
         *
         * @param callback
         * @param aabb
         */

        public void query(TreeCallback callback, AABB aabb)
        {
            m_tree.query(callback, aabb);
        }
Beispiel #5
0
        public void query(TreeCallback callback, AABB aabb)
        {
            Debug.Assert(aabb.isValid());
            nodeStackIndex = 0;
            nodeStack[nodeStackIndex++] = m_root;

            while (nodeStackIndex > 0)
            {
                DynamicTreeNode node = nodeStack[--nodeStackIndex];
                if (node == null)
                {
                    continue;
                }

                if (AABB.testOverlap(node.aabb, aabb))
                {
                    if (node.child1 == null)
                    {
                        bool proceed = callback.treeCallback(node.id);
                        if (!proceed)
                        {
                            return;
                        }
                    }
                    else
                    {
                        if (nodeStack.Length - nodeStackIndex - 2 <= 0)
                        {
                            DynamicTreeNode[] newBuffer = new DynamicTreeNode[nodeStack.Length*2];
                            Array.Copy(nodeStack, 0, newBuffer, 0, nodeStack.Length);
                            nodeStack = newBuffer;
                        }
                        nodeStack[nodeStackIndex++] = node.child1;
                        nodeStack[nodeStackIndex++] = node.child2;
                    }
                }
            }
        }
        public void query(TreeCallback callback, AABB aabb)
        {
            nodeStackIndex = 0;
            nodeStack[nodeStackIndex++] = m_root;

            while (nodeStackIndex > 0)
            {
                int node = nodeStack[--nodeStackIndex];
                if (node == NULL_NODE)
                {
                    continue;
                }

                if (AABB.testOverlap(m_aabb[node], aabb))
                {
                    int child1 = m_child1[node];
                    if (child1 == NULL_NODE)
                    {
                        bool proceed = callback.treeCallback(node);
                        if (!proceed)
                        {
                            return;
                        }
                    }
                    else
                    {
                        if (nodeStack.Length - nodeStackIndex - 2 <= 0)
                        {
                            nodeStack =
                                BufferUtils.reallocateBuffer(nodeStack, nodeStack.Length, nodeStack.Length*2);
                        }
                        nodeStack[nodeStackIndex++] = child1;
                        nodeStack[nodeStackIndex++] = m_child2[node];
                    }
                }
            }
        }