OLD | NEW |
1 <!DOCTYPE HTML> | 1 <!DOCTYPE HTML> |
2 <script src="../../resources/testharness.js"></script> | 2 <script src="../../resources/testharness.js"></script> |
3 <script src="../../resources/testharnessreport.js"></script> | 3 <script src="../../resources/testharnessreport.js"></script> |
4 <script src="./resources/geometry-interfaces-test-helpers.js"></script> | 4 <script src="./resources/geometry-interfaces-test-helpers.js"></script> |
5 <script> | 5 <script> |
6 | 6 |
7 function deg2rad(degrees) { | 7 function deg2rad(degrees) { |
8 return degrees * Math.PI / 180; | 8 return degrees * Math.PI / 180; |
9 } | 9 } |
10 | 10 |
| 11 function rad2deg(radians) { |
| 12 return radians * 180 / Math.PI; |
| 13 } |
| 14 |
11 function getRotationMatrix(x, y, z, alpha_in_degrees) { | 15 function getRotationMatrix(x, y, z, alpha_in_degrees) { |
12 // Vector normalizing | 16 // Vector normalizing |
13 var nx = x; | 17 var nx = x; |
14 var ny = y; | 18 var ny = y; |
15 var nz = z; | 19 var nz = z; |
16 var length = Math.sqrt(x * x + y * y + z * z); | 20 var length = Math.sqrt(x * x + y * y + z * z); |
17 if (length) { | 21 if (length) { |
18 nx = x / length; | 22 nx = x / length; |
19 ny = y / length; | 23 ny = y / length; |
20 nz = z / length; | 24 nz = z / length; |
(...skipping 19 matching lines...) Expand all Loading... |
40 var m34 = 0; | 44 var m34 = 0; |
41 var m41 = 0; | 45 var m41 = 0; |
42 var m42 = 0; | 46 var m42 = 0; |
43 var m43 = 0; | 47 var m43 = 0; |
44 var m44 = 1; | 48 var m44 = 1; |
45 | 49 |
46 return new DOMMatrix([m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m
34, m41, m42, m43, m44]); | 50 return new DOMMatrix([m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m
34, m41, m42, m43, m44]); |
47 } | 51 } |
48 | 52 |
49 test(() => { | 53 test(() => { |
| 54 var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
| 55 var rotateResult = matrix.rotate(60); |
| 56 matrix.rotateSelf(60); |
| 57 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
| 58 expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 60)); |
| 59 assert_matrix_almost_equals(rotateResult, expectedResult); |
| 60 assert_matrix_almost_equals(matrix, expectedResult); |
| 61 }, "DOMMatrix 2d - rotate(rotX) and rotateSelf(rotX)"); |
| 62 |
| 63 test(() => { |
| 64 var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16]); |
| 65 var rotateResult = matrix.rotate(77); |
| 66 matrix.rotateSelf(77); |
| 67 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); |
| 68 expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 77)); |
| 69 assert_matrix_almost_equals(rotateResult, expectedResult); |
| 70 assert_matrix_almost_equals(matrix, expectedResult); |
| 71 }, "DOMMatrix 3d - rotate(rotX) and rotateSelf(rotX)"); |
| 72 |
| 73 test(() => { |
| 74 var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
| 75 var rotateResult = matrix.rotate(10, 20); |
| 76 matrix.rotateSelf(10, 20); |
| 77 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
| 78 expectedResult.multiplySelf(getRotationMatrix(0, 1, 0, 20)); |
| 79 expectedResult.multiplySelf(getRotationMatrix(1, 0, 0, 10)); |
| 80 assert_matrix_almost_equals(rotateResult, expectedResult); |
| 81 assert_matrix_almost_equals(matrix, expectedResult); |
| 82 }, "DOMMatrix 2d - rotate(rotX, rotY) and rotateSelf(rotX, rotY)"); |
| 83 |
| 84 test(() => { |
| 85 var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16]); |
| 86 var rotateResult = matrix.rotate(23, 50); |
| 87 matrix.rotateSelf(23, 50); |
| 88 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); |
| 89 expectedResult.multiplySelf(getRotationMatrix(0, 1, 0, 50)); |
| 90 expectedResult.multiplySelf(getRotationMatrix(1, 0, 0, 23)); |
| 91 assert_matrix_almost_equals(rotateResult, expectedResult); |
| 92 assert_matrix_almost_equals(matrix, expectedResult); |
| 93 }, "DOMMatrix 3d - rotate(rotX, rotY) and rotateSelf(rotX, rotY)"); |
| 94 |
| 95 test(() => { |
| 96 var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
| 97 var rotateResult = matrix.rotate(39, 10, 50); |
| 98 matrix.rotateSelf(39, 10, 50); |
| 99 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
| 100 expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 50)); |
| 101 expectedResult.multiplySelf(getRotationMatrix(0, 1, 0, 10)); |
| 102 expectedResult.multiplySelf(getRotationMatrix(1, 0, 0, 39)); |
| 103 assert_matrix_almost_equals(rotateResult, expectedResult); |
| 104 assert_matrix_almost_equals(matrix, expectedResult); |
| 105 }, "DOMMatrix 2d - rotate(rotX, rotY, rotX) and rotateSelf(rotX, rotY, rotX)"); |
| 106 |
| 107 test(() => { |
| 108 var matrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16]); |
| 109 var rotateResult = matrix.rotate(55, 66, 88); |
| 110 matrix.rotateSelf(55, 66, 88); |
| 111 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); |
| 112 expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 88)); |
| 113 expectedResult.multiplySelf(getRotationMatrix(0, 1, 0, 66)); |
| 114 expectedResult.multiplySelf(getRotationMatrix(1, 0, 0, 55)); |
| 115 assert_matrix_almost_equals(rotateResult, expectedResult); |
| 116 assert_matrix_almost_equals(matrix, expectedResult); |
| 117 }, "DOMMatrix 3d - rotate(rotX, rotY, rotX) and rotateSelf(rotX, rotY, rotX)"); |
| 118 |
| 119 test(function() { |
| 120 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
| 121 var rotateResult = matrix2d.rotateFromVector(4, 7); |
| 122 var expected = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
| 123 expected.rotateSelf(rad2deg(Math.atan2(7, 4))); |
| 124 assert_matrix_almost_equals(rotateResult, expected); |
| 125 matrix2d.rotateFromVectorSelf(4, 7); |
| 126 assert_matrix_almost_equals(matrix2d, expected); |
| 127 }, "DOMMatrix 2d - rotateFromVector(x, y) and rotateFromVectorSelf(x, y)"); |
| 128 |
| 129 test(function() { |
| 130 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); |
| 131 var rotateResult = matrix3d.rotateFromVector(4, 7); |
| 132 var expected = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); |
| 133 expected.rotateSelf(rad2deg(Math.atan2(7, 4))); |
| 134 assert_matrix_almost_equals(rotateResult, expected); |
| 135 matrix3d.rotateFromVectorSelf(4, 7); |
| 136 assert_matrix_almost_equals(matrix3d, expected); |
| 137 }, "DOMMatrix 3d - rotateFromVector(x, y) rotateFromVectorSelf(x, y)"); |
| 138 |
| 139 test(() => { |
50 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 140 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
51 matrix2d.rotateAxisAngleSelf(); | 141 matrix2d.rotateAxisAngleSelf(); |
52 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 142 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
53 expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 0, 0)); | 143 expectedResult.multiplySelf(getRotationMatrix(0, 0, 0, 0)); |
54 assert_true(matrix2d.is2D); | 144 assert_true(matrix2d.is2D); |
55 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 145 assert_matrix_almost_equals(matrix2d, expectedResult); |
56 }, "DOMMatrix 2d - rotateAxisAngleSelf()"); | 146 }, "DOMMatrix 2d - rotateAxisAngleSelf()"); |
57 | 147 |
58 test(() => { | 148 test(() => { |
59 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 149 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
60 matrix2d.rotateAxisAngleSelf(0, 0, 1); | 150 matrix2d.rotateAxisAngleSelf(0, 0, 1); |
61 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 151 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
62 expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 0)); | 152 expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 0)); |
63 assert_true(matrix2d.is2D); | 153 assert_true(matrix2d.is2D); |
64 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 154 assert_matrix_almost_equals(matrix2d, expectedResult); |
65 }, "DOMMatrix 2d - rotateAxisAngleSelf(0, 0, 1)"); | 155 }, "DOMMatrix 2d - rotateAxisAngleSelf(0, 0, 1)"); |
66 | 156 |
67 test(() => { | 157 test(() => { |
68 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 158 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
69 matrix2d.rotateAxisAngleSelf(1, 1, 1); | 159 matrix2d.rotateAxisAngleSelf(1, 1, 1); |
70 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 160 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
71 expectedMatrix.multiplySelf(getRotationMatrix(1, 1, 1, 0)); | 161 expectedResult.multiplySelf(getRotationMatrix(1, 1, 1, 0)); |
72 assert_false(matrix2d.is2D); | 162 assert_false(matrix2d.is2D); |
73 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 163 assert_matrix_almost_equals(matrix2d, expectedResult); |
74 }, "DOMMatrix 2d - rotateAxisAngleSelf(1, 1, 1, 0)"); | 164 }, "DOMMatrix 2d - rotateAxisAngleSelf(1, 1, 1, 0)"); |
75 | 165 |
76 test(() => { | 166 test(() => { |
77 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 167 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
78 matrix2d.rotateAxisAngleSelf(1, 0, 0, 10); | 168 matrix2d.rotateAxisAngleSelf(1, 0, 0, 10); |
79 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 169 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
80 expectedMatrix.multiplySelf(getRotationMatrix(1, 0, 0, 10)); | 170 expectedResult.multiplySelf(getRotationMatrix(1, 0, 0, 10)); |
81 assert_false(matrix2d.is2D); | 171 assert_false(matrix2d.is2D); |
82 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 172 assert_matrix_almost_equals(matrix2d, expectedResult); |
83 }, "DOMMatrix 2d - rotateAxisAngleSelf(1, 0, 0, 10)"); | 173 }, "DOMMatrix 2d - rotateAxisAngleSelf(1, 0, 0, 10)"); |
84 | 174 |
85 test(() => { | 175 test(() => { |
86 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 176 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
87 matrix2d.rotateAxisAngleSelf(0, 1, 0, 27); | 177 matrix2d.rotateAxisAngleSelf(0, 1, 0, 27); |
88 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 178 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
89 expectedMatrix.multiplySelf(getRotationMatrix(0, 1, 0, 27)); | 179 expectedResult.multiplySelf(getRotationMatrix(0, 1, 0, 27)); |
90 assert_false(matrix2d.is2D); | 180 assert_false(matrix2d.is2D); |
91 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 181 assert_matrix_almost_equals(matrix2d, expectedResult); |
92 }, "DOMMatrix 2d - rotateAxisAngleSelf(0, 1, 0, 27)"); | 182 }, "DOMMatrix 2d - rotateAxisAngleSelf(0, 1, 0, 27)"); |
93 | 183 |
94 test(() => { | 184 test(() => { |
95 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 185 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
96 matrix2d.rotateAxisAngleSelf(0, 0, 1, 38); | 186 matrix2d.rotateAxisAngleSelf(0, 0, 1, 38); |
97 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 187 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
98 expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 38)); | 188 expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 38)); |
99 assert_true(matrix2d.is2D); | 189 assert_true(matrix2d.is2D); |
100 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 190 assert_matrix_almost_equals(matrix2d, expectedResult); |
101 }, "DOMMatrix 2d - rotateAxisAngleSelf(0, 0, 1, 38)"); | 191 }, "DOMMatrix 2d - rotateAxisAngleSelf(0, 0, 1, 38)"); |
102 | 192 |
103 test(() => { | 193 test(() => { |
104 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 194 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
105 matrix2d.rotateAxisAngleSelf(1, 1, 1, 45); | 195 matrix2d.rotateAxisAngleSelf(1, 1, 1, 45); |
106 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 196 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
107 expectedMatrix.multiplySelf(getRotationMatrix(1, 1, 1, 45)); | 197 expectedResult.multiplySelf(getRotationMatrix(1, 1, 1, 45)); |
108 assert_false(matrix2d.is2D); | 198 assert_false(matrix2d.is2D); |
109 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 199 assert_matrix_almost_equals(matrix2d, expectedResult); |
110 }, "DOMMatrix 2d - rotateAxisAngleSelf(1, 1, 1, 45)"); | 200 }, "DOMMatrix 2d - rotateAxisAngleSelf(1, 1, 1, 45)"); |
111 | 201 |
112 test(() => { | 202 test(() => { |
113 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); | 203 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); |
114 matrix3d.rotateAxisAngleSelf(); | 204 matrix3d.rotateAxisAngleSelf(); |
115 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); | 205 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); |
116 expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 0, 0)); | 206 expectedResult.multiplySelf(getRotationMatrix(0, 0, 0, 0)); |
117 assert_false(matrix3d.is2D); | 207 assert_false(matrix3d.is2D); |
118 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 208 assert_matrix_almost_equals(matrix3d, expectedResult); |
119 }, "DOMMatrix 3d - rotateAxisAngleSelf()"); | 209 }, "DOMMatrix 3d - rotateAxisAngleSelf()"); |
120 | 210 |
121 test(() => { | 211 test(() => { |
122 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); | 212 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); |
123 matrix3d.rotateAxisAngleSelf(0, 0, 1); | 213 matrix3d.rotateAxisAngleSelf(0, 0, 1); |
124 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); | 214 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); |
125 expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 0)); | 215 expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 0)); |
126 assert_false(matrix3d.is2D); | 216 assert_false(matrix3d.is2D); |
127 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 217 assert_matrix_almost_equals(matrix3d, expectedResult); |
128 }, "DOMMatrix 3d - rotateAxisAngleSelf(0, 0, 1)"); | 218 }, "DOMMatrix 3d - rotateAxisAngleSelf(0, 0, 1)"); |
129 | 219 |
130 test(() => { | 220 test(() => { |
131 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); | 221 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); |
132 matrix3d.rotateAxisAngleSelf(0, 0, 1, 0); | 222 matrix3d.rotateAxisAngleSelf(0, 0, 1, 0); |
133 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); | 223 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); |
134 expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 0)); | 224 expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 0)); |
135 assert_false(matrix3d.is2D); | 225 assert_false(matrix3d.is2D); |
136 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 226 assert_matrix_almost_equals(matrix3d, expectedResult); |
137 }, "DOMMatrix 3d - rotateAxisAngleSelf(0, 0, 1, 0)"); | 227 }, "DOMMatrix 3d - rotateAxisAngleSelf(0, 0, 1, 0)"); |
138 | 228 |
139 test(() => { | 229 test(() => { |
140 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); | 230 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); |
141 matrix3d.rotateAxisAngleSelf(1, 0, 0, 19); | 231 matrix3d.rotateAxisAngleSelf(1, 0, 0, 19); |
142 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); | 232 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); |
143 expectedMatrix.multiplySelf(getRotationMatrix(1, 0, 0, 19)); | 233 expectedResult.multiplySelf(getRotationMatrix(1, 0, 0, 19)); |
144 assert_false(matrix3d.is2D); | 234 assert_false(matrix3d.is2D); |
145 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 235 assert_matrix_almost_equals(matrix3d, expectedResult); |
146 }, "DOMMatrix 3d - rotateAxisAngleSelf(1, 0, 0, 19)"); | 236 }, "DOMMatrix 3d - rotateAxisAngleSelf(1, 0, 0, 19)"); |
147 | 237 |
148 test(() => { | 238 test(() => { |
149 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); | 239 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); |
150 matrix3d.rotateAxisAngleSelf(0, 1, 0, 46); | 240 matrix3d.rotateAxisAngleSelf(0, 1, 0, 46); |
151 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); | 241 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); |
152 expectedMatrix.multiplySelf(getRotationMatrix(0, 1, 0, 46)); | 242 expectedResult.multiplySelf(getRotationMatrix(0, 1, 0, 46)); |
153 assert_false(matrix3d.is2D); | 243 assert_false(matrix3d.is2D); |
154 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 244 assert_matrix_almost_equals(matrix3d, expectedResult); |
155 }, "DOMMatrix 3d - rotateAxisAngleSelf(0, 1, 0, 46)"); | 245 }, "DOMMatrix 3d - rotateAxisAngleSelf(0, 1, 0, 46)"); |
156 | 246 |
157 test(() => { | 247 test(() => { |
158 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); | 248 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); |
159 matrix3d.rotateAxisAngleSelf(0, 0, 1, 65); | 249 matrix3d.rotateAxisAngleSelf(0, 0, 1, 65); |
160 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); | 250 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); |
161 expectedMatrix.multiplySelf(getRotationMatrix(0, 0, 1, 65)); | 251 expectedResult.multiplySelf(getRotationMatrix(0, 0, 1, 65)); |
162 assert_false(matrix3d.is2D); | 252 assert_false(matrix3d.is2D); |
163 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 253 assert_matrix_almost_equals(matrix3d, expectedResult); |
164 }, "DOMMatrix 3d - rotateAxisAngleSelf(0, 0, 1, 65)"); | 254 }, "DOMMatrix 3d - rotateAxisAngleSelf(0, 0, 1, 65)"); |
165 | 255 |
166 test(() => { | 256 test(() => { |
167 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); | 257 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); |
168 matrix3d.rotateAxisAngleSelf(1, 1, 1, 67); | 258 matrix3d.rotateAxisAngleSelf(1, 1, 1, 67); |
169 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); | 259 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); |
170 expectedMatrix.multiplySelf(getRotationMatrix(1, 1, 1, 67)); | 260 expectedResult.multiplySelf(getRotationMatrix(1, 1, 1, 67)); |
171 assert_false(matrix3d.is2D); | 261 assert_false(matrix3d.is2D); |
172 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 262 assert_matrix_almost_equals(matrix3d, expectedResult); |
173 }, "DOMMatrix 3d - rotateAxisAngleSelf(1, 1, 1, 67)"); | 263 }, "DOMMatrix 3d - rotateAxisAngleSelf(1, 1, 1, 67)"); |
174 | 264 |
175 test(() => { | 265 test(() => { |
176 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 266 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
177 matrix2d = matrix2d.rotateAxisAngle(); | 267 matrix2d = matrix2d.rotateAxisAngle(); |
178 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 268 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
179 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 0, 0)); | 269 expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 0, 0)); |
180 assert_true(matrix2d.is2D); | 270 assert_true(matrix2d.is2D); |
181 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 271 assert_matrix_almost_equals(matrix2d, expectedResult); |
182 }, "DOMMatrixReadOnly 2d - rotateAxisAngle()"); | 272 }, "DOMMatrixReadOnly 2d - rotateAxisAngle()"); |
183 | 273 |
184 test(() => { | 274 test(() => { |
185 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 275 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
186 matrix2d = matrix2d.rotateAxisAngle(0, 0, 1); | 276 matrix2d = matrix2d.rotateAxisAngle(0, 0, 1); |
187 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 277 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
188 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 0)); | 278 expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 1, 0)); |
189 assert_true(matrix2d.is2D); | 279 assert_true(matrix2d.is2D); |
190 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 280 assert_matrix_almost_equals(matrix2d, expectedResult); |
191 }, "DOMMatrixReadOnly 2d - rotateAxisAngle(0, 0, 1)"); | 281 }, "DOMMatrixReadOnly 2d - rotateAxisAngle(0, 0, 1)"); |
192 | 282 |
193 test(() => { | 283 test(() => { |
194 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 284 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
195 matrix2d = matrix2d.rotateAxisAngle(1, 1, 1); | 285 matrix2d = matrix2d.rotateAxisAngle(1, 1, 1); |
196 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 286 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
197 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 1, 1, 0)); | 287 expectedResult = expectedResult.multiply(getRotationMatrix(1, 1, 1, 0)); |
198 }, "DOMMatrixReadOnly 2d - rotateAxisAngle(1, 1, 1, 0)"); | 288 }, "DOMMatrixReadOnly 2d - rotateAxisAngle(1, 1, 1, 0)"); |
199 | 289 |
200 test(() => { | 290 test(() => { |
201 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 291 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
202 matrix2d = matrix2d.rotateAxisAngle(1, 0, 0, 21); | 292 matrix2d = matrix2d.rotateAxisAngle(1, 0, 0, 21); |
203 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 293 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
204 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 0, 0, 21)); | 294 expectedResult = expectedResult.multiply(getRotationMatrix(1, 0, 0, 21)); |
205 assert_false(matrix2d.is2D); | 295 assert_false(matrix2d.is2D); |
206 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 296 assert_matrix_almost_equals(matrix2d, expectedResult); |
207 }, "DOMMatrixReadOnly 2d - rotateAxisAngle(1, 0, 0, 21)"); | 297 }, "DOMMatrixReadOnly 2d - rotateAxisAngle(1, 0, 0, 21)"); |
208 | 298 |
209 test(() => { | 299 test(() => { |
210 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 300 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
211 matrix2d = matrix2d.rotateAxisAngle(0, 1, 0, 35); | 301 matrix2d = matrix2d.rotateAxisAngle(0, 1, 0, 35); |
212 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 302 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
213 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 1, 0, 35)); | 303 expectedResult = expectedResult.multiply(getRotationMatrix(0, 1, 0, 35)); |
214 assert_false(matrix2d.is2D); | 304 assert_false(matrix2d.is2D); |
215 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 305 assert_matrix_almost_equals(matrix2d, expectedResult); |
216 }, "DOMMatrixReadOnly 2d - rotateAxisAngle(0, 1, 0, 35)"); | 306 }, "DOMMatrixReadOnly 2d - rotateAxisAngle(0, 1, 0, 35)"); |
217 | 307 |
218 test(() => { | 308 test(() => { |
219 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 309 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
220 matrix2d = matrix2d.rotateAxisAngle(0, 0, 1, 55); | 310 matrix2d = matrix2d.rotateAxisAngle(0, 0, 1, 55); |
221 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 311 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
222 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 55)); | 312 expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 1, 55)); |
223 assert_true(matrix2d.is2D); | 313 assert_true(matrix2d.is2D); |
224 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 314 assert_matrix_almost_equals(matrix2d, expectedResult); |
225 }, "DOMMatrixReadOnly 2d - rotateAxisAngle(0, 0, 1, 55)"); | 315 }, "DOMMatrixReadOnly 2d - rotateAxisAngle(0, 0, 1, 55)"); |
226 | 316 |
227 test(() => { | 317 test(() => { |
228 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 318 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
229 matrix2d = matrix2d.rotateAxisAngle(1, 1, 1, 75); | 319 matrix2d = matrix2d.rotateAxisAngle(1, 1, 1, 75); |
230 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 320 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
231 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 1, 1, 75)); | 321 expectedResult = expectedResult.multiply(getRotationMatrix(1, 1, 1, 75)); |
232 assert_false(matrix2d.is2D); | 322 assert_false(matrix2d.is2D); |
233 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 323 assert_matrix_almost_equals(matrix2d, expectedResult); |
234 }, "DOMMatrixReadOnly 2d - rotateAxisAngle(1, 1, 1, 75)"); | 324 }, "DOMMatrixReadOnly 2d - rotateAxisAngle(1, 1, 1, 75)"); |
235 | 325 |
236 test(() => { | 326 test(() => { |
237 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); | 327 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); |
238 matrix3d = matrix3d.rotateAxisAngle(); | 328 matrix3d = matrix3d.rotateAxisAngle(); |
239 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); | 329 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); |
240 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 0, 0)); | 330 expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 0, 0)); |
241 assert_false(matrix3d.is2D); | 331 assert_false(matrix3d.is2D); |
242 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 332 assert_matrix_almost_equals(matrix3d, expectedResult); |
243 }, "DOMMatrixReadOnly 3d - rotateAxisAngle()"); | 333 }, "DOMMatrixReadOnly 3d - rotateAxisAngle()"); |
244 | 334 |
245 test(() => { | 335 test(() => { |
246 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); | 336 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); |
247 matrix3d = matrix3d.rotateAxisAngle(0, 0, 1); | 337 matrix3d = matrix3d.rotateAxisAngle(0, 0, 1); |
248 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); | 338 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); |
249 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 0)); | 339 expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 1, 0)); |
250 assert_false(matrix3d.is2D); | 340 assert_false(matrix3d.is2D); |
251 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 341 assert_matrix_almost_equals(matrix3d, expectedResult); |
252 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 0, 1)"); | 342 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 0, 1)"); |
253 | 343 |
254 test(() => { | 344 test(() => { |
255 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); | 345 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); |
256 matrix3d = matrix3d.rotateAxisAngle(0, 0, 1, 0); | 346 matrix3d = matrix3d.rotateAxisAngle(0, 0, 1, 0); |
257 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); | 347 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); |
258 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 0)); | 348 expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 1, 0)); |
259 assert_false(matrix3d.is2D); | 349 assert_false(matrix3d.is2D); |
260 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 350 assert_matrix_almost_equals(matrix3d, expectedResult); |
261 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 0, 1, 0)"); | 351 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 0, 1, 0)"); |
262 | 352 |
263 test(() => { | 353 test(() => { |
264 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); | 354 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); |
265 matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, 0); | 355 matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, 0); |
266 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); | 356 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); |
267 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 1, 1, 0)); | 357 expectedResult = expectedResult.multiply(getRotationMatrix(1, 1, 1, 0)); |
268 assert_false(matrix3d.is2D); | 358 assert_false(matrix3d.is2D); |
269 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 359 assert_matrix_almost_equals(matrix3d, expectedResult); |
270 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(1, 1, 1, 0)"); | 360 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(1, 1, 1, 0)"); |
271 | 361 |
272 test(() => { | 362 test(() => { |
273 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); | 363 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); |
274 matrix3d = matrix3d.rotateAxisAngle(1, 0, 0, 105); | 364 matrix3d = matrix3d.rotateAxisAngle(1, 0, 0, 105); |
275 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); | 365 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); |
276 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 0, 0, 105)); | 366 expectedResult = expectedResult.multiply(getRotationMatrix(1, 0, 0, 105)); |
277 assert_false(matrix3d.is2D); | 367 assert_false(matrix3d.is2D); |
278 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 368 assert_matrix_almost_equals(matrix3d, expectedResult); |
279 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(1, 0, 0, 105)"); | 369 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(1, 0, 0, 105)"); |
280 | 370 |
281 test(() => { | 371 test(() => { |
282 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); | 372 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); |
283 matrix3d = matrix3d.rotateAxisAngle(0, 1, 0, 45); | 373 matrix3d = matrix3d.rotateAxisAngle(0, 1, 0, 45); |
284 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); | 374 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); |
285 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 1, 0, 45)); | 375 expectedResult = expectedResult.multiply(getRotationMatrix(0, 1, 0, 45)); |
286 assert_false(matrix3d.is2D); | 376 assert_false(matrix3d.is2D); |
287 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 377 assert_matrix_almost_equals(matrix3d, expectedResult); |
288 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 1, 0, 45)"); | 378 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 1, 0, 45)"); |
289 | 379 |
290 test(() => { | 380 test(() => { |
291 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); | 381 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); |
292 matrix3d = matrix3d.rotateAxisAngle(0, 0, 1, 65); | 382 matrix3d = matrix3d.rotateAxisAngle(0, 0, 1, 65); |
293 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); | 383 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); |
294 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(0, 0, 1, 65)); | 384 expectedResult = expectedResult.multiply(getRotationMatrix(0, 0, 1, 65)); |
295 assert_false(matrix3d.is2D); | 385 assert_false(matrix3d.is2D); |
296 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 386 assert_matrix_almost_equals(matrix3d, expectedResult); |
297 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 0, 1, 65)"); | 387 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(0, 0, 1, 65)"); |
298 | 388 |
299 test(() => { | 389 test(() => { |
300 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); | 390 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); |
301 matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, 78); | 391 matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, 78); |
302 var expectedMatrix = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); | 392 var expectedResult = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
12, 13, 14, 15, 16]); |
303 expectedMatrix = expectedMatrix.multiply(getRotationMatrix(1, 1, 1, 78)); | 393 expectedResult = expectedResult.multiply(getRotationMatrix(1, 1, 1, 78)); |
304 assert_false(matrix3d.is2D); | 394 assert_false(matrix3d.is2D); |
305 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 395 assert_matrix_almost_equals(matrix3d, expectedResult); |
306 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(1, 1, 1, 78)"); | 396 }, "DOMMatrixReadOnly 3d - rotateAxisAngle(1, 1, 1, 78)"); |
307 | 397 |
308 test(() => { | 398 test(() => { |
309 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 399 var matrix2d = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
310 matrix2d.rotateAxisAngleSelf(1, 0, 0, 90); | 400 matrix2d.rotateAxisAngleSelf(1, 0, 0, 90); |
311 matrix2d.rotateAxisAngleSelf(1, 0, 0, -90); | 401 matrix2d.rotateAxisAngleSelf(1, 0, 0, -90); |
312 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 402 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
313 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 403 assert_matrix_almost_equals(matrix2d, expectedResult); |
314 }, "DOMMatrix 2d - rotateAxisAngleSelf() - do rotate +90,-90"); | 404 }, "DOMMatrix 2d - rotateAxisAngleSelf() - do rotate +90,-90"); |
315 | 405 |
316 test(() => { | 406 test(() => { |
317 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); | 407 var matrix2d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6]); |
318 matrix2d = matrix2d.rotateAxisAngle(0, 1, 0, -180); | 408 matrix2d = matrix2d.rotateAxisAngle(0, 1, 0, -180); |
319 matrix2d = matrix2d.rotateAxisAngle(0, 1, 0, +180); | 409 matrix2d = matrix2d.rotateAxisAngle(0, 1, 0, +180); |
320 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6]); | 410 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6]); |
321 assert_matrix_almost_equals(matrix2d, expectedMatrix); | 411 assert_matrix_almost_equals(matrix2d, expectedResult); |
322 }, "DOMMatrix 2d - rotateAxisAngle() - do rotate -180,+180" ); | 412 }, "DOMMatrix 2d - rotateAxisAngle() - do rotate -180,+180" ); |
323 | 413 |
324 test(() => { | 414 test(() => { |
325 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); | 415 var matrix3d = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1
5, 16]); |
326 matrix3d.rotateAxisAngleSelf(1, 1, 0, 90); | 416 matrix3d.rotateAxisAngleSelf(1, 1, 0, 90); |
327 matrix3d.rotateAxisAngleSelf(1, 1, 0, -90); | 417 matrix3d.rotateAxisAngleSelf(1, 1, 0, -90); |
328 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); | 418 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); |
329 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 419 assert_matrix_almost_equals(matrix3d, expectedResult); |
330 }, "DOMMatrix 3d - rotateAxisAngleSelf() - do rotate +90,-90"); | 420 }, "DOMMatrix 3d - rotateAxisAngleSelf() - do rotate +90,-90"); |
331 | 421 |
332 test(() => { | 422 test(() => { |
333 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); | 423 var matrix3d = new DOMMatrixReadOnly([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 1
3, 14, 15, 16]); |
334 matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, -180); | 424 matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, -180); |
335 matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, +180); | 425 matrix3d = matrix3d.rotateAxisAngle(1, 1, 1, +180); |
336 var expectedMatrix = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); | 426 var expectedResult = new DOMMatrix([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16]); |
337 assert_matrix_almost_equals(matrix3d, expectedMatrix); | 427 assert_matrix_almost_equals(matrix3d, expectedResult); |
338 }, "DOMMatrix 3d - rotateAxisAngle() - do rotate -180,+180"); | 428 }, "DOMMatrix 3d - rotateAxisAngle() - do rotate -180,+180"); |
339 | 429 |
340 test(() => { | 430 test(() => { |
341 var matrix3d = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
; | 431 var matrix3d = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
; |
342 matrix3d = matrix3d.rotateAxisAngle(0, 0, 1, -90); | 432 matrix3d = matrix3d.rotateAxisAngle(0, 0, 1, -90); |
343 var expectedMatrix1 = new DOMMatrix([0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0,
0, 0]); | 433 var expectedResult1 = new DOMMatrix([0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0,
0, 0]); |
344 assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix1.toFloat6
4Array()); | 434 assert_matrix_almost_equals(matrix3d, expectedResult1); |
345 matrix3d = matrix3d.rotateAxisAngle(1, 0, 0, -90); | 435 matrix3d = matrix3d.rotateAxisAngle(1, 0, 0, -90); |
346 var expectedMatrix2 = new DOMMatrix([0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0,
0, 0]); | 436 var expectedResult2 = new DOMMatrix([0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0,
0, 0]); |
347 assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix2.toFloat6
4Array()); | 437 assert_matrix_almost_equals(matrix3d, expectedResult2); |
348 matrix3d = matrix3d.rotateAxisAngle(0, 1, 0, -90); | 438 matrix3d = matrix3d.rotateAxisAngle(0, 1, 0, -90); |
349 var expectedMatrix3 = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0]); | 439 var expectedResult3 = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0]); |
350 assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix3.toFloat6
4Array()); | 440 assert_matrix_almost_equals(matrix3d, expectedResult3); |
351 }, "DOMMatrix 3d - rotateAxisAngle()"); | 441 }, "DOMMatrix 3d - rotateAxisAngle()"); |
352 | 442 |
353 test(() => { | 443 test(() => { |
354 var matrix3d = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
; | 444 var matrix3d = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0])
; |
355 matrix3d.rotateAxisAngleSelf(0, 0, 1, -90); | 445 matrix3d.rotateAxisAngleSelf(0, 0, 1, -90); |
356 var expectedMatrix1 = new DOMMatrix([0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0,
0, 0]); | 446 var expectedResult1 = new DOMMatrix([0, 0, 0, 0, 1, 2, 3, 4, 0, 0, 0, 0, 0, 0,
0, 0]); |
357 assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix1.toFloat6
4Array()); | 447 assert_matrix_almost_equals(matrix3d, expectedResult1); |
358 matrix3d.rotateAxisAngleSelf(1, 0, 0, -90); | 448 matrix3d.rotateAxisAngleSelf(1, 0, 0, -90); |
359 var expectedMatrix2 = new DOMMatrix([0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0,
0, 0]); | 449 var expectedResult2 = new DOMMatrix([0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 0, 0,
0, 0]); |
360 assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix2.toFloat6
4Array()); | 450 assert_matrix_almost_equals(matrix3d, expectedResult2); |
361 matrix3d.rotateAxisAngleSelf(0, 1, 0, -90); | 451 matrix3d.rotateAxisAngleSelf(0, 1, 0, -90); |
362 var expectedMatrix3 = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0]); | 452 var expectedResult3 = new DOMMatrix([1, 2, 3, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0]); |
363 assert_array_almost_equals(matrix3d.toFloat64Array(), expectedMatrix3.toFloat6
4Array()); | 453 assert_matrix_almost_equals(matrix3d, expectedResult3); |
364 }, "DOMMatrix 3d - rotateAxisAngleSelf()"); | 454 }, "DOMMatrix 3d - rotateAxisAngleSelf()"); |
365 | 455 |
366 </script> | 456 </script> |
OLD | NEW |