diff --git a/tests/test-output.txt b/tests/test-output.txt index cd2e060..838c2c3 100644 --- a/tests/test-output.txt +++ b/tests/test-output.txt @@ -1040,3 +1040,21 @@ q(0.88595670, 0.46237046, 0.02352080, -0.02722242) 0.00000, 0.00000, 0.00000, 1.00000] # matrix to quat test # matrix to quat test +# matrix to quat test +Test Mat3 * Mat3: +[1.0000, 0.0000, 0.0000, +0.0000, 1.0000, 0.0000, +50.0000, 50.0000, 0.0000] +[1.0000, 0.0000, 0.0000, +0.0000, 1.0000, 0.0000, +50.0000, 50.0000, 1.0000] +[300.0000, 360.0000, 420.0000, +660.0000, 810.0000, 960.0000, +1020.0000, 1260.0000, 1500.0000] +[300.0000, 360.0000, 420.0000, +660.0000, 810.0000, 960.0000, +1020.0000, 1260.0000, 1500.0000] +Test Mat3 * Vec2 and Vec3: +(50.00000000, 50.00000000, 1.00000000) +(50.0000, 50.0000) +(50.00000000, 50.00000000, 1.00000000) diff --git a/tests/test.nim b/tests/test.nim index 9026420..2a87526 100644 --- a/tests/test.nim +++ b/tests/test.nim @@ -221,6 +221,23 @@ block: # s.writeLine m2 # assert m1.close(m2) +block: + s.writeLine "# matrix to quat test" + var a3 = mat3(0.9659258723258972, -0.258819043636322, 0.0, 0.258819043636322, 0.9659258723258972, 0.0, -25.00000953674316, 70.09619140625, 1.0) + var b3 = mat3(0.9659258127212524, 0.258819043636322, 0.0, -0.258819043636322, 0.9659258127212524, 0.0, 77.64571380615234, 0.0, 1.0) + + s.writeLine "Test Mat3 * Mat3:" + s.writeLine (a3.mat4 * b3.mat4).mat3 + s.writeLine a3 * b3 + + s.writeLine (mat3(1,2,3,4,5,6,7,8,9).mat4Rotation * mat3(10,20,30,40,50,60,70,80,90).mat4Rotation).mat3Rotation + s.writeLine mat3(1,2,3,4,5,6,7,8,9) * mat3(10,20,30,40,50,60,70,80,90) + + s.writeLine "Test Mat3 * Vec2 and Vec3:" + s.writeLine a3.mat4 * vec3(77.64571380615234, 0, 1) + s.writeLine a3 * vec2(77.64571380615234, 0) + s.writeLine a3 * vec3(77.64571380615234, 0, 1.0) + s.close() let (outp, _) = execCmdEx("git diff tests/test-output.txt") diff --git a/tests/testm3.nim b/tests/testm3.nim deleted file mode 100644 index ccba41e..0000000 --- a/tests/testm3.nim +++ /dev/null @@ -1,16 +0,0 @@ -import vmath - -var a3 = mat3(0.9659258723258972, -0.258819043636322, 0.0, 0.258819043636322, 0.9659258723258972, 0.0, -25.00000953674316, 70.09619140625, 1.0) -var b3 = mat3(0.9659258127212524, 0.258819043636322, 0.0, -0.258819043636322, 0.9659258127212524, 0.0, 77.64571380615234, 0.0, 1.0) - -echo "Test Mat3 * Mat3:" -echo (a3.mat4 * b3.mat4).mat3 -echo a3 * b3 - -echo (mat3(1,2,3,4,5,6,7,8,9).mat4Rotation * mat3(10,20,30,40,50,60,70,80,90).mat4Rotation).mat3Rotation -echo mat3(1,2,3,4,5,6,7,8,9) * mat3(10,20,30,40,50,60,70,80,90) - -echo "Test Mat3 * Vec2 and Vec3:" -echo a3.mat4 * vec3(77.64571380615234, 0, 1) -echo a3 * vec2(77.64571380615234, 0) -echo a3 * vec3(77.64571380615234, 0, 1.0)