Package org.jbox2d.collision

Examples of org.jbox2d.collision.AABB


    }
  }
 
  public boolean testOverlap(DynamicTreeNode proxyA, DynamicTreeNode proxyB) {
//    return AABB.testOverlap(proxyA.aabb, proxyB.aabb);
    AABB a = proxyA.aabb;
    AABB b = proxyB.aabb;
    if (b.lowerBound.x - a.upperBound.x > 0.0f || b.lowerBound.y - a.upperBound.y > 0.0f) {
      return false;
    }
   
    if (a.lowerBound.x - b.upperBound.x > 0.0f || a.lowerBound.y - b.upperBound.y > 0.0f) {
View Full Code Here


   
    float[] maxFraction = new float[1];
    maxFraction[0] = argInput.maxFraction;
   
    // Build a bounding box for the segment.
    final AABB segAABB = aabb;
    // b2Vec2 t = p1 + maxFraction * (p2 - p1);
    final Vec2 temp = vec2s.pop();
    temp.set(p2).subLocal(p1).mulLocal(maxFraction[0]).addLocal(p1);
    Vec2.minToOut(p1, temp, segAABB.lowerBound);
    Vec2.maxToOut(p1, temp, segAABB.upperBound);
View Full Code Here

  public OrderedStackAABB(int argStackSize, int argContainerSize) {
    super(argStackSize, argContainerSize);
    pool = new AABB[argStackSize];
    for (int i = 0; i < argStackSize; i++) {
      pool[i] = new AABB();
    }
    container = new AABB[argContainerSize];
    for (int i = 0; i < argContainerSize; i++) {
      container[i] = new AABB();
    }
  }
View Full Code Here

      AABB[] sk = new AABB[argSize];
      for (int i = 0; i < argOld.length; i++) {
        sk[i] = argOld[i];
      }
      for (int i = argOld.length; i < argSize; i++) {
        sk[i] = new AABB();
      }
      return sk;
    } else {
      AABB[] sk = new AABB[argSize];
      for (int i = 0; i < argSize; i++) {
        sk[i] = new AABB();
      }
      return sk;
    }
  }
View Full Code Here

        if (b.isActive() == false) {
          continue;
        }
       
        for (Fixture f = b.getFixtureList(); f != null; f = f.getNext()) {
          AABB aabb = f.m_proxy.aabb;
          Vec2[] vs = avs.get(4);
          vs[0].set(aabb.lowerBound.x, aabb.lowerBound.y);
          vs[1].set(aabb.upperBound.x, aabb.lowerBound.y);
          vs[2].set(aabb.upperBound.x, aabb.upperBound.y);
          vs[3].set(aabb.lowerBound.x, aabb.upperBound.y);
View Full Code Here

    return m_tree.getFatAABB(proxyId);
  }

  public boolean testOverlap (int proxyIdA, int proxyIdB) {
    // return AABB.testOverlap(proxyA.aabb, proxyB.aabb);
    final AABB a = m_tree.getFatAABB(proxyIdA);
    final AABB b = m_tree.getFatAABB(proxyIdB);
    if (b.lowerBound.x - a.upperBound.x > 0.0f || b.lowerBound.y - a.upperBound.y > 0.0f) {
      return false;
    }

    if (a.lowerBound.x - b.upperBound.x > 0.0f || a.lowerBound.y - b.upperBound.y > 0.0f) {
View Full Code Here

        continue;
      }

      // We have to query the tree with the fat AABB so that
      // we don't fail to create a pair that may touch later.
      final AABB fatAABB = m_tree.getFatAABB(m_queryProxyId);

      // Query tree, create pairs and add them pair buffer.
      // log.debug("quering aabb: "+m_queryProxy.aabb);
      m_tree.query(this, fatAABB);
    }
View Full Code Here

  @Override
  public final int createProxy (final AABB aabb, Object userData) {
    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;
View Full Code Here

  public final boolean moveProxy (int proxyId, final AABB aabb, Vec2 displacement) {
    assert (0 <= proxyId && proxyId < m_nodeCapacity);
    final DynamicTreeNode node = m_nodes[proxyId];
    assert (node.isLeaf());

    final AABB nodeAABB = node.aabb;
    // if (nodeAABB.contains(aabb)) {
    if (nodeAABB.lowerBound.x > aabb.lowerBound.x && nodeAABB.lowerBound.y > aabb.lowerBound.y
      && aabb.upperBound.x > nodeAABB.upperBound.x && aabb.upperBound.y > nodeAABB.upperBound.y) {
      return false;
    }
View Full Code Here

    // |dot(v, p1 - c)| > dot(|v|, h)

    float maxFraction = input.maxFraction;

    // Build a bounding box for the segment.
    final AABB segAABB = aabb;
    // Vec2 t = p1 + maxFraction * (p2 - p1);
    // before inline
    // temp.set(p2).subLocal(p1).mulLocal(maxFraction).addLocal(p1);
    // Vec2.minToOut(p1, temp, segAABB.lowerBound);
    // Vec2.maxToOut(p1, temp, segAABB.upperBound);
    tempx = (p2x - p1x) * maxFraction + p1x;
    tempy = (p2y - p1y) * maxFraction + p1y;
    segAABB.lowerBound.x = p1x < tempx ? p1x : tempx;
    segAABB.lowerBound.y = p1y < tempy ? p1y : tempy;
    segAABB.upperBound.x = p1x > tempx ? p1x : tempx;
    segAABB.upperBound.y = p1y > tempy ? p1y : tempy;
    // end inline

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

      final AABB nodeAABB = node.aabb;
      if (!AABB.testOverlap(nodeAABB, segAABB)) {
        continue;
      }

      // Separating axis for segment (Gino, p80).
View Full Code Here

TOP

Related Classes of org.jbox2d.collision.AABB

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.