blob: 40b29a7fb92b530819eca1959fb75feecce5edc0 [file] [log] [blame]
<!DOCTYPE HTML>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="./resources/geometry-interfaces-test-helpers.js"></script>
<script>
function deg2rad(degrees) {
return degrees * Math.PI / 180;
}
function getRotationMatrix(x, y, z, alpha_in_degrees) {
// Vector normalizing
var nx = x;
var ny = y;
var nz = z;
var length = Math.sqrt(x * x + y * y + z * z);
if (length) {
nx = x / length;
ny = y / length;
nz = z / length;
}
// The 3D rotation matrix is described in CSS Transforms with alpha.
// Please see: https://drafts.csswg.org/css-transforms-1/#Rotate3dDefined
var alpha_in_radians = deg2rad(alpha_in_degrees / 2);
var sc = Math.sin(alpha_in_radians) * Math.cos(alpha_in_radians);
var sq = Math.sin(alpha_in_radians) * Math.sin(alpha_in_radians);
var m11 = 1 - 2 * (ny * ny + nz * nz) * sq;
var m12 = 2 * (nx * ny * sq + nz * sc);
var m13 = 2 * (nx * nz * sq - ny * sc);
var m14 = 0;
var m21 = 2 * (nx * ny * sq - nz * sc);
var m22 = 1 - 2 * (nx * nx + nz * nz) * sq;
var m23 = 2 * (ny * nz * sq + nx * sc);
var m24 = 0;
var m31 = 2 * (nx * nz * sq + ny * sc);
var m32 = 2 * (ny * nz * sq - nx * sc);
var m33 = 1 - 2 * (nx * nx + ny * ny) * sq;
var m34 = 0;
var m41 = 0;
var m42 = 0;
var m43 = 0;
var m44 = 1;
return new DOMMatrix([m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44]);
}
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));
assert_true(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
assert_true(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
assert_false(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
assert_false(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
assert_false(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
assert_true(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
assert_false(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_true(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
assert_true(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
}, "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));
assert_false(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
assert_false(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
assert_true(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
assert_false(matrix2d.is2D);
assert_matrix_almost_equals(matrix2d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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));
assert_false(matrix3d.is2D);
assert_matrix_almost_equals(matrix3d, expectedMatrix);
}, "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);
}, "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);
}, "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);
}, "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);
}, "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());
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());
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());
}, "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());
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());
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());
}, "DOMMatrix 3d - rotateAxisAngleSelf()");
</script>