congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
DynamicTreeNode
Code IndexAdd Tabnine to your IDE (free)

How to use
DynamicTreeNode
in
org.jbox2d.collision.broadphase

Best Java code snippets using org.jbox2d.collision.broadphase.DynamicTreeNode (Showing top 20 results out of 315)

origin: libgdx/libgdx

private final DynamicTreeNode allocateNode() {
 if (m_freeList == NULL_NODE) {
  assert (m_nodeCount == m_nodeCapacity);
  DynamicTreeNode[] old = m_nodes;
  m_nodeCapacity *= 2;
  m_nodes = new DynamicTreeNode[m_nodeCapacity];
  System.arraycopy(old, 0, m_nodes, 0, old.length);
  // Build a linked list for the free list.
  for (int i = m_nodeCapacity - 1; i >= m_nodeCount; i--) {
   m_nodes[i] = new DynamicTreeNode(i);
   m_nodes[i].parent = (i == m_nodeCapacity - 1) ? null : m_nodes[i + 1];
   m_nodes[i].height = -1;
  }
  m_freeList = m_nodeCount;
 }
 int nodeId = m_freeList;
 final DynamicTreeNode treeNode = m_nodes[nodeId];
 m_freeList = treeNode.parent != null ? treeNode.parent.id : NULL_NODE;
 treeNode.parent = null;
 treeNode.child1 = null;
 treeNode.child2 = null;
 treeNode.height = 0;
 treeNode.userData = null;
 ++m_nodeCount;
 return treeNode;
}
origin: org.jbox2d/jbox2d-library

@Override
public final void destroyProxy(int proxyId) {
 assert (0 <= proxyId && proxyId < m_nodeCapacity);
 DynamicTreeNode node = m_nodes[proxyId];
 assert (node.isLeaf());
 removeLeaf(node);
 freeNode(node);
}
origin: org.jbox2d/jbox2d-library

@Override
public int getMaxBalance() {
 int maxBalance = 0;
 for (int i = 0; i < m_nodeCapacity; ++i) {
  final DynamicTreeNode node = m_nodes[i];
  if (node.height <= 1) {
   continue;
  }
  assert (node.isLeaf() == false);
  DynamicTreeNode child1 = node.child1;
  DynamicTreeNode child2 = node.child2;
  int balance = MathUtils.abs(child2.height - child1.height);
  maxBalance = MathUtils.max(maxBalance, balance);
 }
 return maxBalance;
}
origin: libgdx/libgdx

public DynamicTree() {
 m_root = null;
 m_nodeCount = 0;
 m_nodeCapacity = 16;
 m_nodes = new DynamicTreeNode[16];
 // Build a linked list for the free list.
 for (int i = m_nodeCapacity - 1; i >= 0; i--) {
  m_nodes[i] = new DynamicTreeNode(i);
  m_nodes[i].parent = (i == m_nodeCapacity - 1) ? null : m_nodes[i + 1];
  m_nodes[i].height = -1;
 }
 m_freeList = 0;
 for (int i = 0; i < drawVecs.length; i++) {
  drawVecs[i] = new Vec2();
 }
}
origin: org.jbox2d/jbox2d-library

private final int computeHeight(DynamicTreeNode node) {
 assert (0 <= node.id && node.id < m_nodeCapacity);
 if (node.isLeaf()) {
  return 0;
 }
 int height1 = computeHeight(node.child1);
 int height2 = computeHeight(node.child2);
 return 1 + MathUtils.max(height1, height2);
}
origin: jbox2d/jbox2d

private final DynamicTreeNode allocateNode() {
 if (m_freeList == NULL_NODE) {
  assert (m_nodeCount == m_nodeCapacity);
  DynamicTreeNode[] old = m_nodes;
  m_nodeCapacity *= 2;
  m_nodes = new DynamicTreeNode[m_nodeCapacity];
  System.arraycopy(old, 0, m_nodes, 0, old.length);
  // Build a linked list for the free list.
  for (int i = m_nodeCapacity - 1; i >= m_nodeCount; i--) {
   m_nodes[i] = new DynamicTreeNode(i);
   m_nodes[i].parent = (i == m_nodeCapacity - 1) ? null : m_nodes[i + 1];
   m_nodes[i].height = -1;
  }
  m_freeList = m_nodeCount;
 }
 int nodeId = m_freeList;
 final DynamicTreeNode treeNode = m_nodes[nodeId];
 m_freeList = treeNode.parent != null ? treeNode.parent.id : NULL_NODE;
 treeNode.parent = null;
 treeNode.child1 = null;
 treeNode.child2 = null;
 treeNode.height = 0;
 treeNode.userData = null;
 ++m_nodeCount;
 return treeNode;
}
origin: org.jbox2d/jbox2d-library

private void validateStructure(DynamicTreeNode node) {
 if (node == null) {
  return;
 }
 assert (node == m_nodes[node.id]);
 if (node == m_root) {
  assert (node.parent == null);
 }
 DynamicTreeNode child1 = node.child1;
 DynamicTreeNode child2 = node.child2;
 if (node.isLeaf()) {
  assert (child1 == null);
  assert (child2 == null);
  assert (node.height == 0);
  return;
 }
 assert (child1 != null && 0 <= child1.id && child1.id < m_nodeCapacity);
 assert (child2 != null && 0 <= child2.id && child2.id < m_nodeCapacity);
 assert (child1.parent == node);
 assert (child2.parent == node);
 validateStructure(child1);
 validateStructure(child2);
}
origin: jbox2d/jbox2d

public DynamicTree() {
 m_root = null;
 m_nodeCount = 0;
 m_nodeCapacity = 16;
 m_nodes = new DynamicTreeNode[16];
 // Build a linked list for the free list.
 for (int i = m_nodeCapacity - 1; i >= 0; i--) {
  m_nodes[i] = new DynamicTreeNode(i);
  m_nodes[i].parent = (i == m_nodeCapacity - 1) ? null : m_nodes[i + 1];
  m_nodes[i].height = -1;
 }
 m_freeList = 0;
 for (int i = 0; i < drawVecs.length; i++) {
  drawVecs[i] = new Vec2();
 }
}
origin: org.jbox2d/jbox2d-library

assert (0 <= proxyId && proxyId < m_nodeCapacity);
final DynamicTreeNode node = m_nodes[proxyId];
assert (node.isLeaf());
origin: org.jbox2d/jbox2d-library

private final DynamicTreeNode allocateNode() {
 if (m_freeList == NULL_NODE) {
  assert (m_nodeCount == m_nodeCapacity);
  DynamicTreeNode[] old = m_nodes;
  m_nodeCapacity *= 2;
  m_nodes = new DynamicTreeNode[m_nodeCapacity];
  System.arraycopy(old, 0, m_nodes, 0, old.length);
  // Build a linked list for the free list.
  for (int i = m_nodeCapacity - 1; i >= m_nodeCount; i--) {
   m_nodes[i] = new DynamicTreeNode(i);
   m_nodes[i].parent = (i == m_nodeCapacity - 1) ? null : m_nodes[i + 1];
   m_nodes[i].height = -1;
  }
  m_freeList = m_nodeCount;
 }
 int nodeId = m_freeList;
 final DynamicTreeNode treeNode = m_nodes[nodeId];
 m_freeList = treeNode.parent != null ? treeNode.parent.id : NULL_NODE;
 treeNode.parent = null;
 treeNode.child1 = null;
 treeNode.child2 = null;
 treeNode.height = 0;
 treeNode.userData = null;
 ++m_nodeCount;
 return treeNode;
}
origin: org.jbox2d/jbox2d-library

private void validateMetrics(DynamicTreeNode node) {
 if (node == null) {
  return;
 }
 DynamicTreeNode child1 = node.child1;
 DynamicTreeNode child2 = node.child2;
 if (node.isLeaf()) {
  assert (child1 == null);
  assert (child2 == null);
  assert (node.height == 0);
  return;
 }
 assert (child1 != null && 0 <= child1.id && child1.id < m_nodeCapacity);
 assert (child2 != null && 0 <= child2.id && child2.id < m_nodeCapacity);
 int height1 = child1.height;
 int height2 = child2.height;
 int height;
 height = 1 + MathUtils.max(height1, height2);
 assert (node.height == height);
 AABB aabb = new AABB();
 aabb.combine(child1.aabb, child2.aabb);
 assert (aabb.lowerBound.equals(node.aabb.lowerBound));
 assert (aabb.upperBound.equals(node.aabb.upperBound));
 validateMetrics(child1);
 validateMetrics(child2);
}
origin: com.github.almasb/fxgl-physics

private final DynamicTreeNode allocateNode() {
  if (m_freeList == NULL_NODE) {
    assert (m_nodeCount == m_nodeCapacity);
    DynamicTreeNode[] old = m_nodes;
    m_nodeCapacity *= 2;
    m_nodes = new DynamicTreeNode[m_nodeCapacity];
    System.arraycopy(old, 0, m_nodes, 0, old.length);
    // Build a linked list for the free list.
    for (int i = m_nodeCapacity - 1; i >= m_nodeCount; i--) {
      m_nodes[i] = new DynamicTreeNode(i);
      m_nodes[i].parent = (i == m_nodeCapacity - 1) ? null : m_nodes[i + 1];
      m_nodes[i].height = -1;
    }
    m_freeList = m_nodeCount;
  }
  int nodeId = m_freeList;
  final DynamicTreeNode treeNode = m_nodes[nodeId];
  m_freeList = treeNode.parent != null ? treeNode.parent.id : NULL_NODE;
  treeNode.parent = null;
  treeNode.child1 = null;
  treeNode.child2 = null;
  treeNode.height = 0;
  treeNode.userData = null;
  ++m_nodeCount;
  return treeNode;
}
origin: org.jbox2d/jbox2d-library

if (node.isLeaf()) {
 node.parent = null;
 nodes[count] = i;
origin: andmizi/MobikeTags

private final DynamicTreeNode allocateNode() {
 if (m_freeList == NULL_NODE) {
  assert (m_nodeCount == m_nodeCapacity);
  DynamicTreeNode[] old = m_nodes;
  m_nodeCapacity *= 2;
  m_nodes = new DynamicTreeNode[m_nodeCapacity];
  System.arraycopy(old, 0, m_nodes, 0, old.length);
  // Build a linked list for the free list.
  for (int i = m_nodeCapacity - 1; i >= m_nodeCount; i--) {
   m_nodes[i] = new DynamicTreeNode(i);
   m_nodes[i].parent = (i == m_nodeCapacity - 1) ? null : m_nodes[i + 1];
   m_nodes[i].height = -1;
  }
  m_freeList = m_nodeCount;
 }
 int nodeId = m_freeList;
 final DynamicTreeNode treeNode = m_nodes[nodeId];
 m_freeList = treeNode.parent != null ? treeNode.parent.id : NULL_NODE;
 treeNode.parent = null;
 treeNode.child1 = null;
 treeNode.child2 = null;
 treeNode.height = 0;
 treeNode.userData = null;
 ++m_nodeCount;
 return treeNode;
}
origin: org.jbox2d/jbox2d-library

if (child1.isLeaf()) {
 combinedAABB.combine(leafAABB, child1.aabb);
 cost1 = combinedAABB.getPerimeter() + inheritanceCost;
if (child2.isLeaf()) {
 combinedAABB.combine(leafAABB, child2.aabb);
 cost2 = combinedAABB.getPerimeter() + inheritanceCost;
origin: andmizi/MobikeTags

public DynamicTree() {
 m_root = null;
 m_nodeCount = 0;
 m_nodeCapacity = 16;
 m_nodes = new DynamicTreeNode[16];
 // Build a linked list for the free list.
 for (int i = m_nodeCapacity - 1; i >= 0; i--) {
  m_nodes[i] = new DynamicTreeNode(i);
  m_nodes[i].parent = (i == m_nodeCapacity - 1) ? null : m_nodes[i + 1];
  m_nodes[i].height = -1;
 }
 m_freeList = 0;
 for (int i = 0; i < drawVecs.length; i++) {
  drawVecs[i] = new Vec2();
 }
}
origin: org.jbox2d/jbox2d-library

if (node.isLeaf()) {
 subInput.p1.x = p1x;
 subInput.p1.y = p1y;
origin: com.github.almasb/fxgl-physics

public DynamicTree() {
  m_root = null;
  m_nodeCount = 0;
  m_nodeCapacity = 16;
  m_nodes = new DynamicTreeNode[16];
  // Build a linked list for the free list.
  for (int i = m_nodeCapacity - 1; i >= 0; i--) {
    m_nodes[i] = new DynamicTreeNode(i);
    m_nodes[i].parent = (i == m_nodeCapacity - 1) ? null : m_nodes[i + 1];
    m_nodes[i].height = -1;
  }
  m_freeList = 0;
  for (int i = 0; i < drawVecs.length; i++) {
    drawVecs[i] = new Vec2();
  }
}
origin: org.jbox2d/jbox2d-library

if (A.isLeaf() || A.height < 2) {
 return iA;
origin: org.jbox2d/jbox2d-library

public DynamicTree() {
 m_root = null;
 m_nodeCount = 0;
 m_nodeCapacity = 16;
 m_nodes = new DynamicTreeNode[16];
 // Build a linked list for the free list.
 for (int i = m_nodeCapacity - 1; i >= 0; i--) {
  m_nodes[i] = new DynamicTreeNode(i);
  m_nodes[i].parent = (i == m_nodeCapacity - 1) ? null : m_nodes[i + 1];
  m_nodes[i].height = -1;
 }
 m_freeList = 0;
 m_insertionCount = 0;
 for (int i = 0; i < drawVecs.length; i++) {
  drawVecs[i] = new Vec2();
 }
}
org.jbox2d.collision.broadphaseDynamicTreeNode

Most used methods

  • <init>
    Should never be constructed outside the engine
  • isLeaf

Popular in Java

  • Start an intent from android
  • setContentView (Activity)
  • setRequestProperty (URLConnection)
  • notifyDataSetChanged (ArrayAdapter)
  • HttpServer (com.sun.net.httpserver)
    This class implements a simple HTTP server. A HttpServer is bound to an IP address and port number a
  • Kernel (java.awt.image)
  • String (java.lang)
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • JFileChooser (javax.swing)
  • Option (scala)
  • 21 Best Atom Packages for 2021
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now