@Override public final int createProxy(final AABB aabb, Object userData) { assert(aabb.isValid()); final DynamicTreeNode node = allocateNode(); int proxyId = node.id; // Fatten the aabb final AABB nodeAABB = node.aabb; nodeAABB.lowerBound.x = aabb.lowerBound.x - Settings.aabbExtension; nodeAABB.lowerBound.y = aabb.lowerBound.y - Settings.aabbExtension; nodeAABB.upperBound.x = aabb.upperBound.x + Settings.aabbExtension; nodeAABB.upperBound.y = aabb.upperBound.y + Settings.aabbExtension; node.userData = userData; insertLeaf(proxyId); return proxyId; }
@Override public final void query(TreeCallback callback, AABB aabb) { 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) { boolean proceed = callback.treeCallback(node.id); if (!proceed) { return; } } else { if (nodeStack.length - nodeStackIndex - 2 <= 0) { DynamicTreeNode[] newBuffer = new DynamicTreeNode[nodeStack.length * 2]; System.arraycopy(nodeStack, 0, newBuffer, 0, nodeStack.length); nodeStack = newBuffer; } nodeStack[nodeStackIndex++] = node.child1; nodeStack[nodeStackIndex++] = node.child2; } } } }
@Override public final boolean moveProxy(int proxyId, final AABB aabb, Vec2 displacement) { assert(aabb.isValid()); assert (0 <= proxyId && proxyId < m_nodeCapacity); final DynamicTreeNode node = m_nodes[proxyId];
@Override public final int createProxy(final AABB aabb, Object userData) { assert(aabb.isValid()); final DynamicTreeNode node = allocateNode(); int proxyId = node.id; // Fatten the aabb final AABB nodeAABB = node.aabb; nodeAABB.lowerBound.x = aabb.lowerBound.x - Settings.aabbExtension; nodeAABB.lowerBound.y = aabb.lowerBound.y - Settings.aabbExtension; nodeAABB.upperBound.x = aabb.upperBound.x + Settings.aabbExtension; nodeAABB.upperBound.y = aabb.upperBound.y + Settings.aabbExtension; node.userData = userData; insertLeaf(proxyId); return proxyId; }
@Override public final void query(TreeCallback callback, AABB aabb) { 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) { boolean proceed = callback.treeCallback(node.id); if (!proceed) { return; } } else { if (nodeStack.length - nodeStackIndex - 2 <= 0) { DynamicTreeNode[] newBuffer = new DynamicTreeNode[nodeStack.length * 2]; System.arraycopy(nodeStack, 0, newBuffer, 0, nodeStack.length); nodeStack = newBuffer; } nodeStack[nodeStackIndex++] = node.child1; nodeStack[nodeStackIndex++] = node.child2; } } } }
@Override public final boolean moveProxy(int proxyId, final AABB aabb, Vec2 displacement) { assert(aabb.isValid()); assert (0 <= proxyId && proxyId < m_nodeCapacity); final DynamicTreeNode node = m_nodes[proxyId];
@Override public final int createProxy(final AABB aabb, Object userData) { assert (aabb.isValid()); final DynamicTreeNode node = allocateNode(); int proxyId = node.id; // Fatten the aabb final AABB nodeAABB = node.aabb; nodeAABB.lowerBound.x = aabb.lowerBound.x - JBoxSettings.aabbExtension; nodeAABB.lowerBound.y = aabb.lowerBound.y - JBoxSettings.aabbExtension; nodeAABB.upperBound.x = aabb.upperBound.x + JBoxSettings.aabbExtension; nodeAABB.upperBound.y = aabb.upperBound.y + JBoxSettings.aabbExtension; node.userData = userData; insertLeaf(proxyId); return proxyId; }
@Override public final int createProxy(final AABB aabb, Object userData) { assert(aabb.isValid()); final DynamicTreeNode node = allocateNode(); int proxyId = node.id; // Fatten the aabb final AABB nodeAABB = node.aabb; nodeAABB.lowerBound.x = aabb.lowerBound.x - Settings.aabbExtension; nodeAABB.lowerBound.y = aabb.lowerBound.y - Settings.aabbExtension; nodeAABB.upperBound.x = aabb.upperBound.x + Settings.aabbExtension; nodeAABB.upperBound.y = aabb.upperBound.y + Settings.aabbExtension; node.userData = userData; insertLeaf(proxyId); return proxyId; }
@Override public final void query(TreeCallback callback, AABB aabb) { 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) { boolean proceed = callback.treeCallback(node.id); if (!proceed) { return; } } else { if (nodeStack.length - nodeStackIndex - 2 <= 0) { DynamicTreeNode[] newBuffer = new DynamicTreeNode[nodeStack.length * 2]; System.arraycopy(nodeStack, 0, newBuffer, 0, nodeStack.length); nodeStack = newBuffer; } nodeStack[nodeStackIndex++] = node.child1; nodeStack[nodeStackIndex++] = node.child2; } } } }
@Override public final void query(TreeCallback callback, AABB aabb) { 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) { boolean proceed = callback.treeCallback(node.id); if (!proceed) { return; } } else { if (nodeStack.length - nodeStackIndex - 2 <= 0) { DynamicTreeNode[] newBuffer = new DynamicTreeNode[nodeStack.length * 2]; System.arraycopy(nodeStack, 0, newBuffer, 0, nodeStack.length); nodeStack = newBuffer; } nodeStack[nodeStackIndex++] = node.child1; nodeStack[nodeStackIndex++] = node.child2; } } } }
@Override public final boolean moveProxy(int proxyId, final AABB aabb, Vec2 displacement) { assert (aabb.isValid()); assert (0 <= proxyId && proxyId < m_nodeCapacity); final DynamicTreeNode node = m_nodes[proxyId];
@Override public final boolean moveProxy(int proxyId, final AABB aabb, Vec2 displacement) { assert(aabb.isValid()); assert (0 <= proxyId && proxyId < m_nodeCapacity); final DynamicTreeNode node = m_nodes[proxyId];