petersont / o3d

Imported from code.google.com/p/o3d
2 stars 1 forks source link

o3djs.flat_math.matrix4.setUpper3x3 wrong indexing #243

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
http://src.chromium.org/viewvc/chrome/trunk/o3d/samples/o3djs/math.js

Param b should be a 3x3 matrix according to function header but needs to be a 
4x4 according to code. See excerpt below.

/**
 * Sets the upper 3-by-3 block of matrix a to the upper 3-by-3 block of matrix
 * b; assumes that a and b are big enough to contain an upper 3-by-3 block.
 * @param {!o3djs.flat_math.Matrix4} a A matrix.
 * @param {!o3djs.flat_math.Matrix3} b A 3-by-3 matrix.
 * @return {!o3djs.flat_math.Matrix4} a once modified.
 */
o3djs.flat_math.matrix4.setUpper3x3 = function(a, b) {
  a[0] = b[0];
  a[1] = b[1];
  a[2] = b[2];
  a[4] = b[4];
  a[5] = b[5];
  a[6] = b[6];
  a[8] = b[8];
  a[9] = b[9];
  a[10] = b[10];

  return a;
};

Original issue reported on code.google.com by yann.gil...@gmail.com on 2 Jun 2011 at 12:20