function matrixProduct(a, b) {
  var r = [
    a[0] * b[0] + a[2] * b[1],
    a[1] * b[0] + a[3] * b[1],
    a[0] * b[2] + a[2] * b[3],
    a[1] * b[2] + a[3] * b[3]
  ];
  var along = (a.length == 6);
  if (b.length == 6) {
    r.push(a[0] * b[4] + a[2] * b[5] + (along ? a[4] : 0));
    r.push(a[1] * b[4] + a[3] * b[5] + (along ? a[5] : 0));
  } else if (along) {
    r.push(a[4]);
    r.push(a[5]);
  }
  return r;
}
// Multiplies 2x2 or 2x3 matrices.
Multiplies 2x2 or 2x3 matrices.
Multiplies 2x2 or 2x3 matrices .
function matrixProduct(a, b) {
  var r = [
    a[0] * b[0] + a[2] * b[1],
    a[1] * b[0] + a[3] * b[1],
    a[0] * b[2] + a[2] * b[3],
    a[1] * b[2] + a[3] * b[3]
  ];
  var along = (a.length == 6);
  if (b.length == 6) {
    r.push(a[0] * b[4] + a[2] * b[5] + (along ? a[4] : 0));
    r.push(a[1] * b[4] + a[3] * b[5] + (along ? a[5] : 0));
  } else if (along) {
    r.push(a[4]);
    r.push(a[5]);
  }
  return r;
}
function matrixProduct ( a , b ) { var r = [ a [ 0 ] * b [ 0 ] + a [ 2 ] * b [ 1 ] , a [ 1 ] * b [ 0 ] + a [ 3 ] * b [ 1 ] , a [ 0 ] * b [ 2 ] + a [ 2 ] * b [ 3 ] , a [ 1 ] * b [ 2 ] + a [ 3 ] * b [ 3 ] ] ; var along = ( a . length == 6 ) ; if ( b . length == 6 ) { r . push ( a [ 0 ] * b [ 4 ] + a [ 2 ] * b [ 5 ] + ( along ? a [ 4 ] : 0 ) ) ; r . push ( a [ 1 ] * b [ 4 ] + a [ 3 ] * b [ 5 ] + ( along ? a [ 5 ] : 0 ) ) ; } else if ( along ) { r . push ( a [ 4 ] ) ; r . push ( a [ 5 ] ) ; } return r ; }
Multiplies 2x2 or 2x3 matrices.
Multiplies 2x2 or 2x3 matrices .