浏览代码

add another determinant unit tests which utilizes every value of the matrix.

Ben Houston 12 年之前
父节点
当前提交
86feeaeaac
共有 2 个文件被更改,包括 8 次插入0 次删除
  1. 4 0
      test/unit/math/Matrix3.js
  2. 4 0
      test/unit/math/Matrix4.js

+ 4 - 0
test/unit/math/Matrix3.js

@@ -133,6 +133,10 @@ test( "determinant", function() {
 
 	a.elements[0] = 0;
 	ok( a.determinant() == 0, "Passed!" );
+
+	// calculated via http://www.euclideanspace.com/maths/algebra/matrix/functions/determinant/threeD/index.htm
+	a.set( 2, 3, 4, 5, 13, 7, 8, 9, 11 );
+	ok( a.determinant() == -73, "Passed!" );
 });
 
 

+ 4 - 0
test/unit/math/Matrix4.js

@@ -150,6 +150,10 @@ test( "determinant", function() {
 
 	a.elements[0] = 0;
 	ok( a.determinant() == 0, "Passed!" );
+
+	// calculated via http://www.euclideanspace.com/maths/algebra/matrix/functions/determinant/fourD/index.htm
+	a.set( 2, 3, 4, 5, -1, -21, -3, -4, 6, 7, 8, 10, -8, -9, -10, -12 );
+	ok( a.determinant() == 76, "Passed!" );
 });
 
 test( "getInverse", function() {