* Check if the matrix is an identity matrix. * @returns true if the matrix is an identity matrix
()
| 776 | * @returns true if the matrix is an identity matrix |
| 777 | */ |
| 778 | isIdentity() { |
| 779 | const a = this.val; |
| 780 | |
| 781 | // check translation first (most commonly non-zero), then diagonal, then rest |
| 782 | return ( |
| 783 | a[12] === 0 && |
| 784 | a[13] === 0 && |
| 785 | a[0] === 1 && |
| 786 | a[5] === 1 && |
| 787 | a[10] === 1 && |
| 788 | a[15] === 1 && |
| 789 | a[1] === 0 && |
| 790 | a[2] === 0 && |
| 791 | a[3] === 0 && |
| 792 | a[4] === 0 && |
| 793 | a[6] === 0 && |
| 794 | a[7] === 0 && |
| 795 | a[8] === 0 && |
| 796 | a[9] === 0 && |
| 797 | a[11] === 0 && |
| 798 | a[14] === 0 |
| 799 | ); |
| 800 | } |
| 801 | |
| 802 | /** |
| 803 | * return true if the two matrices are identical |
no outgoing calls
no test coverage detected