Index: third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-rotate.html |
diff --git a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-rotate.html b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-rotate.html |
index 40b29a7fb92b530819eca1959fb75feecce5edc0..f0e93ca7d135b67e8d788c3f589a6fa3b5b64db8 100644 |
--- a/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-rotate.html |
+++ b/third_party/WebKit/LayoutTests/fast/dom/geometry-interfaces-dom-matrix-rotate.html |
@@ -8,6 +8,10 @@ function deg2rad(degrees) { |
return degrees * Math.PI / 180; |
} |
+function rad2deg(radians) { |
+ return radians * 180 / Math.PI; |
+} |
+ |
function getRotationMatrix(x, y, z, alpha_in_degrees) { |
// Vector normalizing |
var nx = x; |
@@ -47,320 +51,406 @@ function getRotationMatrix(x, y, z, alpha_in_degrees) { |
} |
test(() => { |
+ var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var rotateResult = matrix.rotate(60); |
+ matrix.rotateSelf(60); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 60)); |
+ assert_matrix_almost_equals(rotateResult, expectedResult); |
+ assert_matrix_almost_equals(matrix, expectedResult); |
+}, "DOMMatrix 2d - rotate(rotX) and rotateSelf(rotX)"); |
+ |
+test(() => { |
+ var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ var rotateResult = matrix.rotate(77); |
+ matrix.rotateSelf(77); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 77)); |
+ assert_matrix_almost_equals(rotateResult, expectedResult); |
+ assert_matrix_almost_equals(matrix, expectedResult); |
+}, "DOMMatrix 3d - rotate(rotX) and rotateSelf(rotX)"); |
+ |
+test(() => { |
+ var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var rotateResult = matrix.rotate(10, 20); |
+ matrix.rotateSelf(10, 20); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 1, 0, 20)); |
+ expectedResult.multiplySelf(getRotationMatrix(1, 0, 0, 10)); |
+ assert_matrix_almost_equals(rotateResult, expectedResult); |
+ assert_matrix_almost_equals(matrix, expectedResult); |
+}, "DOMMatrix 2d - rotate(rotX, rotY) and rotateSelf(rotX, rotY)"); |
+ |
+test(() => { |
+ var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ var rotateResult = matrix.rotate(23, 50); |
+ matrix.rotateSelf(23, 50); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 1, 0, 50)); |
+ expectedResult.multiplySelf(getRotationMatrix(1, 0, 0, 23)); |
+ assert_matrix_almost_equals(rotateResult, expectedResult); |
+ assert_matrix_almost_equals(matrix, expectedResult); |
+}, "DOMMatrix 3d - rotate(rotX, rotY) and rotateSelf(rotX, rotY)"); |
+ |
+test(() => { |
+ var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var rotateResult = matrix.rotate(39, 10, 50); |
+ matrix.rotateSelf(39, 10, 50); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 50)); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 1, 0, 10)); |
+ expectedResult.multiplySelf(getRotationMatrix(1, 0, 0, 39)); |
+ assert_matrix_almost_equals(rotateResult, expectedResult); |
+ assert_matrix_almost_equals(matrix, expectedResult); |
+}, "DOMMatrix 2d - rotate(rotX, rotY, rotX) and rotateSelf(rotX, rotY, rotX)"); |
+ |
+test(() => { |
+ var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ var rotateResult = matrix.rotate(55, 66, 88); |
+ matrix.rotateSelf(55, 66, 88); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 88)); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 1, 0, 66)); |
+ expectedResult.multiplySelf(getRotationMatrix(1, 0, 0, 55)); |
+ assert_matrix_almost_equals(rotateResult, expectedResult); |
+ assert_matrix_almost_equals(matrix, expectedResult); |
+}, "DOMMatrix 3d - rotate(rotX, rotY, rotX) and rotateSelf(rotX, rotY, rotX)"); |
+ |
+test(function() { |
+ var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ var rotateResult = matrix2d.rotateFromVector(4, 7); |
+ var expected = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ expected.rotateSelf(rad2deg(Math.atan2(7, 4))); |
+ assert_matrix_almost_equals(rotateResult, expected); |
+ matrix2d.rotateFromVectorSelf(4, 7); |
+ assert_matrix_almost_equals(matrix2d, expected); |
+}, "DOMMatrix 2d - rotateFromVector(x, y) and rotateFromVectorSelf(x, y)"); |
+ |
+test(function() { |
+ var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ var rotateResult = matrix3d.rotateFromVector(4, 7); |
+ var expected = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expected.rotateSelf(rad2deg(Math.atan2(7, 4))); |
+ assert_matrix_almost_equals(rotateResult, expected); |
+ matrix3d.rotateFromVectorSelf(4, 7); |
+ assert_matrix_almost_equals(matrix3d, expected); |
+}, "DOMMatrix 3d - rotateFromVector(x, y) rotateFromVectorSelf(x, y)"); |
+ |
+test(() => { |
var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
matrix2d.rotateAxisAngleSelf(); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
- expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 0, 0)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 0, 0, 0)); |
assert_true(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrix 2d - rotateAxisAngleSelf()"); |
test(() => { |
var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
matrix2d.rotateAxisAngleSelf(0, 0, 1); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
- expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 0)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 0)); |
assert_true(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrix 2d - rotateAxisAngleSelf(0, 0, 1)"); |
test(() => { |
var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
matrix2d.rotateAxisAngleSelf(1, 1, 1); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
- expectedMatrix.multiplySelf(getRotationMatrix(1, 1, 1, 0)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ expectedResult.multiplySelf(getRotationMatrix(1, 1, 1, 0)); |
assert_false(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrix 2d - rotateAxisAngleSelf(1, 1, 1, 0)"); |
test(() => { |
var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
matrix2d.rotateAxisAngleSelf(1, 0, 0, 10); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
- expectedMatrix.multiplySelf(getRotationMatrix(1, 0, 0, 10)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ expectedResult.multiplySelf(getRotationMatrix(1, 0, 0, 10)); |
assert_false(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrix 2d - rotateAxisAngleSelf(1, 0, 0, 10)"); |
test(() => { |
var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
matrix2d.rotateAxisAngleSelf(0, 1, 0, 27); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
- expectedMatrix.multiplySelf(getRotationMatrix(0, 1, 0, 27)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 1, 0, 27)); |
assert_false(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrix 2d - rotateAxisAngleSelf(0, 1, 0, 27)"); |
test(() => { |
var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
matrix2d.rotateAxisAngleSelf(0, 0, 1, 38); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
- expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 38)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 38)); |
assert_true(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrix 2d - rotateAxisAngleSelf(0, 0, 1, 38)"); |
test(() => { |
var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
matrix2d.rotateAxisAngleSelf(1, 1, 1, 45); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
- expectedMatrix.multiplySelf(getRotationMatrix(1, 1, 1, 45)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ expectedResult.multiplySelf(getRotationMatrix(1, 1, 1, 45)); |
assert_false(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrix 2d - rotateAxisAngleSelf(1, 1, 1, 45)"); |
test(() => { |
var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d.rotateAxisAngleSelf(); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 0, 0)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 0, 0, 0)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrix 3d - rotateAxisAngleSelf()"); |
test(() => { |
var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d.rotateAxisAngleSelf(0, 0, 1); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 0)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 0)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrix 3d - rotateAxisAngleSelf(0, 0, 1)"); |
test(() => { |
var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d.rotateAxisAngleSelf(0, 0, 1, 0); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 0)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 0)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrix 3d - rotateAxisAngleSelf(0, 0, 1, 0)"); |
test(() => { |
var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d.rotateAxisAngleSelf(1, 0, 0, 19); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix.multiplySelf(getRotationMatrix(1, 0, 0, 19)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult.multiplySelf(getRotationMatrix(1, 0, 0, 19)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrix 3d - rotateAxisAngleSelf(1, 0, 0, 19)"); |
test(() => { |
var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d.rotateAxisAngleSelf(0, 1, 0, 46); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix.multiplySelf(getRotationMatrix(0, 1, 0, 46)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 1, 0, 46)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrix 3d - rotateAxisAngleSelf(0, 1, 0, 46)"); |
test(() => { |
var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d.rotateAxisAngleSelf(0, 0, 1, 65); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 65)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 65)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrix 3d - rotateAxisAngleSelf(0, 0, 1, 65)"); |
test(() => { |
var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d.rotateAxisAngleSelf(1, 1, 1, 67); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix.multiplySelf(getRotationMatrix(1, 1, 1, 67)); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult.multiplySelf(getRotationMatrix(1, 1, 1, 67)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrix 3d - rotateAxisAngleSelf(1, 1, 1, 67)"); |
test(() => { |
var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
matrix2d = matrix2d.rotateAxisAngle(); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 0, 0)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 0, 0)); |
assert_true(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrixReadOnly 2d - rotateAxisAngle()"); |
test(() => { |
var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
matrix2d = matrix2d.rotateAxisAngle(0, 0, 1); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 0)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 1, 0)); |
assert_true(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrixReadOnly 2d - rotateAxisAngle(0, 0, 1)"); |
test(() => { |
var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
matrix2d = matrix2d.rotateAxisAngle(1, 1, 1); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 1, 1, 0)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(1, 1, 1, 0)); |
}, "DOMMatrixReadOnly 2d - rotateAxisAngle(1, 1, 1, 0)"); |
test(() => { |
var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
matrix2d = matrix2d.rotateAxisAngle(1, 0, 0, 21); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 0, 0, 21)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(1, 0, 0, 21)); |
assert_false(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrixReadOnly 2d - rotateAxisAngle(1, 0, 0, 21)"); |
test(() => { |
var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
matrix2d = matrix2d.rotateAxisAngle(0, 1, 0, 35); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 1, 0, 35)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(0, 1, 0, 35)); |
assert_false(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrixReadOnly 2d - rotateAxisAngle(0, 1, 0, 35)"); |
test(() => { |
var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
matrix2d = matrix2d.rotateAxisAngle(0, 0, 1, 55); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 55)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 1, 55)); |
assert_true(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrixReadOnly 2d - rotateAxisAngle(0, 0, 1, 55)"); |
test(() => { |
var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
matrix2d = matrix2d.rotateAxisAngle(1, 1, 1, 75); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 1, 1, 75)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(1, 1, 1, 75)); |
assert_false(matrix2d.is2D); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrixReadOnly 2d - rotateAxisAngle(1, 1, 1, 75)"); |
test(() => { |
var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d = matrix3d.rotateAxisAngle(); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 0, 0)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 0, 0)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrixReadOnly 3d - rotateAxisAngle()"); |
test(() => { |
var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d = matrix3d.rotateAxisAngle(0, 0, 1); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 0)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 1, 0)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 0, 1)"); |
test(() => { |
var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d = matrix3d.rotateAxisAngle(0, 0, 1, 0); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 0)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 1, 0)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 0, 1, 0)"); |
test(() => { |
var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, 0); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 1, 1, 0)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(1, 1, 1, 0)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrixReadOnly 3d - rotateAxisAngle(1, 1, 1, 0)"); |
test(() => { |
var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d = matrix3d.rotateAxisAngle(1, 0, 0, 105); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 0, 0, 105)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(1, 0, 0, 105)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrixReadOnly 3d - rotateAxisAngle(1, 0, 0, 105)"); |
test(() => { |
var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d = matrix3d.rotateAxisAngle(0, 1, 0, 45); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 1, 0, 45)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(0, 1, 0, 45)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 1, 0, 45)"); |
test(() => { |
var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d = matrix3d.rotateAxisAngle(0, 0, 1, 65); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 65)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 1, 65)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 0, 1, 65)"); |
test(() => { |
var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, 78); |
- var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 1, 1, 78)); |
+ var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ expectedResult = expectedResult.multiply(getRotationMatrix(1, 1, 1, 78)); |
assert_false(matrix3d.is2D); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrixReadOnly 3d - rotateAxisAngle(1, 1, 1, 78)"); |
test(() => { |
var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
matrix2d.rotateAxisAngleSelf(1, 0, 0, 90); |
matrix2d.rotateAxisAngleSelf(1, 0, 0, -90); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrix 2d - rotateAxisAngleSelf() - do rotate +90,-90"); |
test(() => { |
var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
matrix2d = matrix2d.rotateAxisAngle(0, 1, 0, -180); |
matrix2d = matrix2d.rotateAxisAngle(0, 1, 0, +180); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
- assert_matrix_almost_equals(matrix2d, expectedMatrix); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
+ assert_matrix_almost_equals(matrix2d, expectedResult); |
}, "DOMMatrix 2d - rotateAxisAngle() - do rotate -180,+180" ); |
test(() => { |
var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d.rotateAxisAngleSelf(1, 1, 0, 90); |
matrix3d.rotateAxisAngleSelf(1, 1, 0, -90); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrix 3d - rotateAxisAngleSelf() - do rotate +90,-90"); |
test(() => { |
var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, -180); |
matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, +180); |
- var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
- assert_matrix_almost_equals(matrix3d, expectedMatrix); |
+ var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]); |
+ assert_matrix_almost_equals(matrix3d, expectedResult); |
}, "DOMMatrix 3d - rotateAxisAngle() - do rotate -180,+180"); |
test(() => { |
var matrix3d = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); |
matrix3d = matrix3d.rotateAxisAngle(0, 0, 1, -90); |
- var expectedMatrix1 = new DOMMatrix([0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0]); |
- assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix1.toFloat64Array()); |
+ var expectedResult1 = new DOMMatrix([0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0]); |
+ assert_matrix_almost_equals(matrix3d, expectedResult1); |
matrix3d = matrix3d.rotateAxisAngle(1, 0, 0, -90); |
- var expectedMatrix2 = new DOMMatrix([0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0]); |
- assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix2.toFloat64Array()); |
+ var expectedResult2 = new DOMMatrix([0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0]); |
+ assert_matrix_almost_equals(matrix3d, expectedResult2); |
matrix3d = matrix3d.rotateAxisAngle(0, 1, 0, -90); |
- var expectedMatrix3 = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); |
- assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix3.toFloat64Array()); |
+ var expectedResult3 = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); |
+ assert_matrix_almost_equals(matrix3d, expectedResult3); |
}, "DOMMatrix 3d - rotateAxisAngle()"); |
test(() => { |
var matrix3d = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); |
matrix3d.rotateAxisAngleSelf(0, 0, 1, -90); |
- var expectedMatrix1 = new DOMMatrix([0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0]); |
- assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix1.toFloat64Array()); |
+ var expectedResult1 = new DOMMatrix([0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0]); |
+ assert_matrix_almost_equals(matrix3d, expectedResult1); |
matrix3d.rotateAxisAngleSelf(1, 0, 0, -90); |
- var expectedMatrix2 = new DOMMatrix([0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0]); |
- assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix2.toFloat64Array()); |
+ var expectedResult2 = new DOMMatrix([0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0]); |
+ assert_matrix_almost_equals(matrix3d, expectedResult2); |
matrix3d.rotateAxisAngleSelf(0, 1, 0, -90); |
- var expectedMatrix3 = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); |
- assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix3.toFloat64Array()); |
+ var expectedResult3 = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); |
+ assert_matrix_almost_equals(matrix3d, expectedResult3); |
}, "DOMMatrix 3d - rotateAxisAngleSelf()"); |
</script> |