3Д БУМ

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

Determinants of Matrices

A determinant is a scalar value calculated from the elements of a matrix. Determinants of matrices are useful for many tasks, such as solving system’s linear equations and calculating the area of a parallelogram or parallelepiped. You’ll use determinants in game programming to calculate the inverse of a matrix. I will show you how to calculate the determinant, but I will not show you any of its applications, other than using it to find the inverse of a matrix.

The determinant of a 2×2 matrix is the easiest to calculate. All you need to do is multiply the top-left and bottom-right values together, and then subtract the product of the bottom-left and the top-right values as shown in Figure 1.7.

1 5

7 3

D =

= 1 x3-5×7 = -32

Figure 1.7 Calculating the determinant of a 2×2 matrix. You need to know how to do this before you can calculate the determinates of matrices with dimensions greater than 2×2.

Calculating the determinant of a 3×3 matrix is a bit harder. You first need to break the matrix into minors. To do this all you do is start at the first element in the first row. You eliminate the ith row and the jth column, and you are left with a 2×2 matrix. You multiply this matrix by the element that was used to calculate which row and column to delete. When you complete this process, you will be left with three 2×2 matrices. Next you need to calculate the determinant of each remain­ing matrix and add them together, as shown in Figure 1.8

~1

5

7~

4

9

3

9

3

4

3

4

9

= 1

-5

+ 7

2

8

3

8

3

2

_3

2

8_

—1

—1

—1

1(4 x 8 — 2 x 9) — 5(3 x 8 — 3 x 9) + 7(3 x 2 — 3 x 4) = 14-(-15) + И2) = -13

Figure 1.8 Calculating the determinant of a 3×3 matrix. You first break it into minors and use the definition of a 2×2 determinant to finish it off.

Для любых предложений по сайту: [email protected]