code: function(a, b, r1, r2, k1, k2)
  {
      // calculate mass matrix
      // If I wasn't lazy and wrote a proper matrix class, this wouldn't be so gross...
      var k11, k12, k21, k22;
      var m_sum = a.m_inv + b.m_inv;
      
      // start with I*m_sum
      k11 = m_sum; k12 = 0;
      k21 = 0;     k22 = m_sum;
      
      // add the influence from r1
      var a_i_inv = a.i_inv;
      var r1xsq =  r1.x * r1.x * a_i_inv;
      var r1ysq =  r1.y * r1.y * a_i_inv;
      var r1nxy = -r1.x * r1.y * a_i_inv;
      k11 += r1ysq; k12 += r1nxy;
      k21 += r1nxy; k22 += r1xsq;
      
      // add the influnce from r2
      var b_i_inv = b.i_inv;
      var r2xsq =  r2.x * r2.x * b_i_inv;
      var r2ysq =  r2.y * r2.y * b_i_inv;
      var r2nxy = -r2.x * r2.y * b_i_inv;
      k11 += r2ysq; k12 += r2nxy;
      k21 += r2nxy; k22 += r2xsq;
      
      // invert
      var determinant = k11*k22 - k12*k21;
      assertSoft(determinant !== 0, "Unsolvable constraint.");
      
      var det_inv = 1/determinant;
  
      k1.x =  k22*det_inv; k1.y = -k12*det_inv;
      k2.x = -k21*det_inv; k2.y =  k11*det_inv;
  }
docs: k1 and k2 are modified by the function to contain the outputs.