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;
}