| 1673 | //------------------------------------------------------------------------------ |
| 1674 | template <class T1, class T2> |
| 1675 | inline void vtkInvert3x3(const T1 A[3][3], T2 AI[3][3]) |
| 1676 | { |
| 1677 | double a1 = A[0][0]; |
| 1678 | double b1 = A[0][1]; |
| 1679 | double c1 = A[0][2]; |
| 1680 | double a2 = A[1][0]; |
| 1681 | double b2 = A[1][1]; |
| 1682 | double c2 = A[1][2]; |
| 1683 | double a3 = A[2][0]; |
| 1684 | double b3 = A[2][1]; |
| 1685 | double c3 = A[2][2]; |
| 1686 | |
| 1687 | // Compute the adjoint |
| 1688 | double d1 = vtkMath::Determinant2x2(b2, b3, c2, c3); |
| 1689 | double d2 = -vtkMath::Determinant2x2(a2, a3, c2, c3); |
| 1690 | double d3 = vtkMath::Determinant2x2(a2, a3, b2, b3); |
| 1691 | |
| 1692 | double e1 = -vtkMath::Determinant2x2(b1, b3, c1, c3); |
| 1693 | double e2 = vtkMath::Determinant2x2(a1, a3, c1, c3); |
| 1694 | double e3 = -vtkMath::Determinant2x2(a1, a3, b1, b3); |
| 1695 | |
| 1696 | double f1 = vtkMath::Determinant2x2(b1, b2, c1, c2); |
| 1697 | double f2 = -vtkMath::Determinant2x2(a1, a2, c1, c2); |
| 1698 | double f3 = vtkMath::Determinant2x2(a1, a2, b1, b2); |
| 1699 | |
| 1700 | // Divide by the determinant |
| 1701 | double det = a1 * d1 + b1 * d2 + c1 * d3; |
| 1702 | |
| 1703 | AI[0][0] = d1 / det; |
| 1704 | AI[1][0] = d2 / det; |
| 1705 | AI[2][0] = d3 / det; |
| 1706 | |
| 1707 | AI[0][1] = e1 / det; |
| 1708 | AI[1][1] = e2 / det; |
| 1709 | AI[2][1] = e3 / det; |
| 1710 | |
| 1711 | AI[0][2] = f1 / det; |
| 1712 | AI[1][2] = f2 / det; |
| 1713 | AI[2][2] = f3 / det; |
| 1714 | } |
| 1715 | |
| 1716 | //------------------------------------------------------------------------------ |
| 1717 | void vtkMath::Invert3x3(const float A[3][3], float AI[3][3]) |
no test coverage detected