3Д БУМ

3Д принтеры и всё что с ними связано

ЗД принтеры АБС пластик

The Inverse of a Matrix

Hey, what do you know, the last part of the matrix section is here already. That wasn’t so bad was it? This section is on the inverse of a matrix. The inverse of a matrix satisfies the following equation:

M(M-1) = I. M is the original matrix, M-1 is the inverse of M, and I is the identity matrix. In graphics programming, you could use the inverse of a transformation matrix to cancel out the effects of a previous transfor­mation and return a previous transformation matrix. Not all matrices have an inverse. If a matrix is non-square or has a determinant of zero, it will not have an inverse. In programming it is important to make sure the matrix in question does have an inverse before performing this operation to prevent errors such as divide-by-zero. The inverse of a 3×3 matrix can be calculated as shown in Figure 1.9. In the figure M is the original matrix and the elements in the matrix shown are the cofactors of M, which I explain how to calculate here in a second.

1

det [M]

®11

©12

®13

©21

©22

623

®31

®32

®33

Figure 1.9 Calculating the inverse of a matrix. To calculate the inverse of a matrix, you first find its accompanying cofactor matrix, and then divide it by the determinant of the original matrix.

In order to use that formula, you need to know how to calculate cofactors of the elements of the matrices. The principle is simple; you cross out the ith column and the jthrow. Therefore, if the element is M, you would cross out the first row and the first column, leaving a 2×2 matrix. This is called the minor of the element. Now, you take the 2×2 matrix and calculate the determinant of it; the result of that determi­nant is called the cofactor. See Figure 1.10 for more details.

Now for the last step. Take your newly found cofactor matrix and multiply it by one over the determinant of the original matrix. The determinant in this case is -17, so you multiply the cofactor matrix by — 1/17. By doing this, you have the final inverted matrix, as shown in Figure 1.11.

3 2 3

4 5 5 7 1 3

5 5 1 3

3 2 3 1

M =

= (5×3-1 x 5) = 10

©11 —

-55

— 1 3

— 2 3

— 1 3

= (3 x 1 — 3 x 2) = -3

©12 —

10 -3 -5 23 -12 -3 -3111 7

Figure 1.10 Calculating cofactors. Top:The original matrix.

1

-17

Middle: Calculating two of the cofactors. Bottom: The matrix with all its cofactors calculated.

~10 -3

-5~

-0.588

0.176

0.294 ~

23 -12

-3

-1.353

0.706

0.177

-31 11

7

1.824

-0.647

-0.418

Figure I. II Calculating the inverse of a matrix using the process described in the previous section—results are rounded to three decimal places to save space.

Your email address will not be published. Required fields are marked *

*