OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE HTML> |
| 2 <script src="../../resources/testharness.js"></script> |
| 3 <script src="../../resources/testharnessreport.js"></script> |
| 4 <script src="./resources/geometry-interfaces-test-helpers.js"></script> |
| 5 <script> |
| 6 |
| 7 function transformPoint(matrix, point) { |
| 8 var x = point.x * matrix.m11 + point.y * matrix.m21 + point.z * matrix.m31 + p
oint.w * matrix.m41; |
| 9 var y = point.x * matrix.m12 + point.y * matrix.m22 + point.z * matrix.m32 + p
oint.w * matrix.m42; |
| 10 var z = point.x * matrix.m13 + point.y * matrix.m23 + point.z * matrix.m33 + p
oint.w * matrix.m43; |
| 11 var w = point.x * matrix.m14 + point.y * matrix.m24 + point.z * matrix.m34 + p
oint.w * matrix.m44; |
| 12 return new DOMPoint(x, y, z, w); |
| 13 } |
| 14 |
| 15 test(function() { |
| 16 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
| 17 var point = matrix2d.transformPoint(); |
| 18 var expected = transformPoint(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]), new D
OMPoint()); |
| 19 assert_point_equals(point, expected); |
| 20 }, "DOMMatrixReadOnly transformPoint() - 2d matrix"); |
| 21 |
| 22 test(function() { |
| 23 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); |
| 24 var point = matrix3d.transformPoint(); |
| 25 var expected = transformPoint(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9
, 10, 11, 12, 13, 14, 15, 16]), new DOMPoint()); |
| 26 assert_point_equals(point, expected); |
| 27 }, "DOMMatrixReadOnly transformPoint() - 3d matrix"); |
| 28 |
| 29 test(function() { |
| 30 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
| 31 var point = matrix2d.transformPoint(new DOMPoint(1, 2, 3, 4)); |
| 32 var expected = transformPoint(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]), new D
OMPoint(1, 2, 3, 4)) |
| 33 assert_point_equals(point, expected); |
| 34 }, "DOMMatrixReadOnly transformPoint() - 2d matrix"); |
| 35 |
| 36 test(function() { |
| 37 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); |
| 38 var point = matrix3d.transformPoint(new DOMPoint(1, 2, 3, 4)); |
| 39 var expected = transformPoint(new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9
, 10, 11, 12, 13, 14, 15, 16]), new DOMPoint(1, 2, 3, 4)); |
| 40 assert_point_equals(point, expected); |
| 41 }, "DOMMatrixReadOnly transformPoint() - 3d matrix"); |
| 42 |
| 43 test(function() { |
| 44 var matrix2d = new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]); |
| 45 var point = matrix2d.transformPoint(new DOMPoint(5, 4)); |
| 46 var expected = transformPoint(new DOMMatrixReadOnly([2, 0, 0, 2, 10, 10]), new
DOMPoint(5, 4)); |
| 47 assert_point_equals(point, expected); |
| 48 }, "DOMMatrixReadOnly transformPoint() - 2d matrix"); |
| 49 |
| 50 </script> |
OLD | NEW |