(t *testing.T)
| 1276 | } |
| 1277 | |
| 1278 | func TestMatrixRotationComponent(t *testing.T) { |
| 1279 | data := []struct { |
| 1280 | matrix []float32 |
| 1281 | expected float32 |
| 1282 | }{ |
| 1283 | { |
| 1284 | matrix: []float32{ |
| 1285 | 0, 0, 0, |
| 1286 | 0, 0, 0, |
| 1287 | 0, 0, 0, |
| 1288 | }, |
| 1289 | expected: 0, |
| 1290 | }, |
| 1291 | { |
| 1292 | matrix: []float32{ |
| 1293 | 1, 2, 3, |
| 1294 | 3, 1, 2, |
| 1295 | 2, 3, 1, |
| 1296 | }, |
| 1297 | expected: 63.43495, |
| 1298 | }, |
| 1299 | { |
| 1300 | matrix: []float32{ |
| 1301 | 5, 2, 3, |
| 1302 | 6, -4, 3, |
| 1303 | 1, 4, 2, |
| 1304 | }, |
| 1305 | expected: 21.801409, |
| 1306 | }, |
| 1307 | { |
| 1308 | matrix: []float32{ |
| 1309 | -5, 2, 3, |
| 1310 | 6, -4, 3, |
| 1311 | 1, 4, 2, |
| 1312 | }, |
| 1313 | expected: 158.1986, |
| 1314 | }, |
| 1315 | } |
| 1316 | for _, d := range data { |
| 1317 | mat1 := IdentityMatrix() |
| 1318 | mat1.Set(d.matrix) |
| 1319 | if res := mat1.RotationComponent(); !FloatEqual(res, d.expected) { |
| 1320 | t.Errorf("Rotation Component did not match expected!\nMatrix: %v\n Res: %v\n expected: %v\n", d.matrix, res, d.expected) |
| 1321 | return |
| 1322 | } |
| 1323 | } |
| 1324 | } |
| 1325 | |
| 1326 | func TestMatrixRotate(t *testing.T) { |
| 1327 | data := []struct { |
nothing calls this directly
no test coverage detected