(m, tolerance = 0.01)
| 45 | } |
| 46 | |
| 47 | function isIdentity(m, tolerance = 0.01) { |
| 48 | const id = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; |
| 49 | for (let i = 0; i < 16; i++) { |
| 50 | if (Math.abs(m[i] - id[i]) > tolerance) return false; |
| 51 | } |
| 52 | return true; |
| 53 | } |
| 54 | |
| 55 | function maxDiffFromIdentity(m) { |
| 56 | const id = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]; |