Examples of Mat22


Examples of org.jbox2d.common.Mat22

    // [ -r1y*iA-r2y*iB, r1x*iA+r2x*iB, iA+iB]

    float mA = m_invMassA, mB = m_invMassB;
    float iA = m_invIA, iB = m_invIB;

    final Mat22 K = pool.popMat22();
    K.ex.x = mA + mB + iA * m_rA.y * m_rA.y + iB * m_rB.y * m_rB.y;
    K.ex.y = -iA * m_rA.x * m_rA.y - iB * m_rB.x * m_rB.y;
    K.ey.x = K.ex.y;
    K.ey.y = mA + mB + iA * m_rA.x * m_rA.x + iB * m_rB.x * m_rB.x;

    K.invertToOut(m_linearMass);

    m_angularMass = iA + iB;
    if (m_angularMass > 0.0f) {
      m_angularMass = 1.0f / m_angularMass;
    }
View Full Code Here

Examples of org.jbox2d.common.Mat22

    m_angularImpulse = 0.0f;
   
    m_maxForce = def.maxForce;
    m_maxTorque = def.maxTorque;
   
    m_linearMass = new Mat22();
  }
View Full Code Here

Examples of org.jbox2d.common.Mat22

    // [ -r1y*iA-r2y*iB, r1x*iA+r2x*iB, iA+iB]
   
    float mA = bA.m_invMass, mB = bB.m_invMass;
    float iA = bA.m_invI, iB = bB.m_invI;
   
    final Mat22 K1 = pool.popMat22();
    K1.m11 = mA + mB;
    K1.m21 = 0.0f;
    K1.m12 = 0.0f;
    K1.m22 = mA + mB;
   
    final Mat22 K2 = pool.popMat22();
    K2.m11 = iA * rA.y * rA.y;
    K2.m21 = -iA * rA.x * rA.y;
    K2.m12 = -iA * rA.x * rA.y;
    K2.m22 = iA * rA.x * rA.x;
   
    final Mat22 K3 = pool.popMat22();
    K3.m11 = iB * rB.y * rB.y;
    K3.m21 = -iB * rB.x * rB.y;
    K3.m12 = -iB * rB.x * rB.y;
    K3.m22 = iB * rB.x * rB.x;
   
 
View Full Code Here

Examples of org.jbox2d.common.Mat22

    // Solve linear limit constraint.
    float linearError = 0.0f, angularError = 0.0f;
    boolean active = false;
    float C2 = 0.0f;
   
    final Mat22 R1 = pool.popMat22();
    final Mat22 R2 = pool.popMat22();
    R1.set(a1);
    R2.set(a2);
   
    final Vec2 temp = pool.popVec2();
    final Vec2 r1 = pool.popVec2();
    final Vec2 r2 = pool.popVec2();
    final Vec2 d = pool.popVec2();
View Full Code Here

Examples of org.jbox2d.common.Mat22

    float wB = data.velocities[m_indexB].w;

    final Rot qA = pool.popRot();
    final Rot qB = pool.popRot();
    final Vec2 temp = pool.popVec2();
    Mat22 K = pool.popMat22();

    qA.set(aA);
    qB.set(aB);

    // Compute the effective mass matrix.
    // m_rA = b2Mul(qA, -m_localCenterA);
    // m_rB = b2Mul(qB, -m_localCenterB);
    m_rA.x = qA.c * -m_localCenterA.x - qA.s * -m_localCenterA.y;
    m_rA.y = qA.s * -m_localCenterA.x + qA.c * -m_localCenterA.y;
    m_rB.x = qB.c * -m_localCenterB.x - qB.s * -m_localCenterB.y;
    m_rB.y = qB.s * -m_localCenterB.x + qB.c * -m_localCenterB.y;

    // J = [-I -r1_skew I r2_skew]
    // [ 0 -1 0 1]
    // r_skew = [-ry; rx]

    // Matlab
    // K = [ mA+r1y^2*iA+mB+r2y^2*iB, -r1y*iA*r1x-r2y*iB*r2x, -r1y*iA-r2y*iB]
    // [ -r1y*iA*r1x-r2y*iB*r2x, mA+r1x^2*iA+mB+r2x^2*iB, r1x*iA+r2x*iB]
    // [ -r1y*iA-r2y*iB, r1x*iA+r2x*iB, iA+iB]
    float mA = m_invMassA, mB = m_invMassB;
    float iA = m_invIA, iB = m_invIB;

    K.ex.x = mA + mB + iA * m_rA.y * m_rA.y + iB * m_rB.y * m_rB.y;
    K.ex.y = -iA * m_rA.x * m_rA.y - iB * m_rB.x * m_rB.y;
    K.ey.x = K.ex.y;
    K.ey.y = mA + mB + iA * m_rA.x * m_rA.x + iB * m_rB.x * m_rB.x;

    K.invertToOut(m_linearMass);

    m_angularMass = iA + iB;
    if (m_angularMass > 0.0f) {
      m_angularMass = 1.0f / m_angularMass;
    }
View Full Code Here

Examples of org.jbox2d.common.Mat22

      }
        break;
      case FACE_B :
        final Vec2 planePoint = pool3;
       
        final Mat22 R = xfB.R;
        normal.x = R.m11 * manifold.localNormal.x + R.m21 * manifold.localNormal.y;
        normal.y = R.m12 * manifold.localNormal.x + R.m22 * manifold.localNormal.y;
        final Vec2 v = manifold.localPoint;
        planePoint.x = xfB.position.x + xfB.R.m11 * v.x + xfB.R.m21 * v.y;
        planePoint.y = xfB.position.y + xfB.R.m12 * v.x + xfB.R.m22 * v.y;
 
View Full Code Here

Examples of org.jbox2d.common.Mat22

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

Examples of org.jbox2d.common.Mat22

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

Examples of org.jbox2d.common.Mat22

    //      = [1/m1+1/m2     0    ] + invI1 * [r1.y*r1.y -r1.x*r1.y] + invI2 * [r1.y*r1.y -r1.x*r1.y]
    //        [    0     1/m1+1/m2]           [-r1.x*r1.y r1.x*r1.x]           [-r1.x*r1.y r1.x*r1.x]
    float invMass = b.m_invMass;
    float invI = b.m_invI;

    Mat22 K1 = pool.popMat22();
    K1.m11 = invMass; K1.m21 = 0.0f;
    K1.m12 = 0.0f;    K1.m22 = invMass;

    Mat22 K2 = pool.popMat22();
    K2.m11 =  invI * r.y * r.y; K2.m21 = -invI * r.x * r.y;
    K2.m12 = -invI * r.x * r.y; K2.m22 =  invI * r.x * r.x;

    Mat22 K = pool.popMat22();
    K.set(K1).addLocal(K2);
    K.m11 += m_gamma;
    K.m22 += m_gamma;

    K.invertToOut(m_mass);

    m_C.set(b.m_sweep.c).addLocal(r).subLocal(m_target);

    // Cheat with some damping
    b.m_angularVelocity *= 0.98f;
View Full Code Here

Examples of org.jbox2d.common.Mat22

    // Solve linear limit constraint.
    float linearError = 0.0f, angularError = 0.0f;
    boolean active = false;
    float C2 = 0.0f;
   
    Mat22 R1 = pool.popMat22();
    Mat22 R2 = pool.popMat22();
    R1.set(a1);
    R2.set(a2);
   
    final Vec2 r1 = pool.popVec2();
    final Vec2 r2 = pool.popVec2();
    final Vec2 temp = pool.popVec2();
    final Vec2 d = pool.popVec2();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.