{"id":32,"date":"2013-11-08T15:46:23","date_gmt":"2013-11-08T15:46:23","guid":{"rendered":"\/\/3dbym.ru\/2013\/11\/understanding-and-using-matrices\/"},"modified":"2013-11-08T15:46:23","modified_gmt":"2013-11-08T15:46:23","slug":"understanding-and-using-matrices","status":"publish","type":"post","link":"https:\/\/3dbym.ru\/2013\/11\/understanding-and-using-matrices\/","title":{"rendered":"Understanding and Using Matrices"},"content":{"rendered":"

Just what is a matrix you ask? Well, simply put, a matrix is a rectangular array of numbers. A few examples of matrices are shown in Figure 1.1. You know what they look like, but just what are they good for? Well, mathematicians like to use them to represent systems of linear equa\u00adtions. Using matrix operations, it is possible to solve these systems with much less work than using other methods, such as substitution, to solve them. In computer graphics, however, matrices are used to represent transformations. Transformations are essentially rotations and translation values for an object. The nice thing about using matrices for this type of thing is the fact that transformations can be combined using simple algebra, making it easy for you, and fast within your programs.<\/p>\n

Most of the matrices that are used in graphics programming are square matrices. A square matrix is simply a matrix that has the same number of rows as columns. The leftmost matrix in Figure 1.1 is a square matrix. Generally, 3D math only requires matrices that are 3×3 or 4×4 elements. For clarity, and to simply keep the size of the figures<\/p>\n<\/p>\n

<\/p>\n\n\n
\n

2<\/p>\n

1<\/p>\n

3<\/p>\n

4<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n\n\n
\n

4<\/p>\n

1<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n\n\n
\n

2<\/p>\n

3<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

<\/p>\n\n\n\n\n
\n

1<\/p>\n<\/td>\n

\n

4<\/p>\n<\/td>\n

\n

3~<\/p>\n<\/td>\n

\n

[1-<\/p>\n<\/td>\n

\n

12<\/p>\n<\/td>\n<\/tr>\n

\n

7<\/p>\n<\/td>\n

\n

1<\/p>\n<\/td>\n

\n

4<\/p>\n<\/td>\n

\n<\/td>\n\n

~ 2<\/p>\n<\/td>\n<\/tr>\n

\n

5<\/p>\n<\/td>\n

\n

7<\/p>\n<\/td>\n

\n

2<\/p>\n<\/td>\n

\n<\/td>\n\n

4<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<\/p>\n<\/p>\n

<\/p>\n

Figure 1.1 A few examples of matrices. Notice that they can be square or rectangular; two dimensions or one.<\/p>\n

down, all the matrices in this chapter from now on will be 3×3 square matrices. Keep in mind that the same principles that apply to 3×3 matrices will also work on 4×4 matrices.<\/p>\n

As you work with OpenGL, D3D, or any other graphics API, you will notice that they use mostly 4×4 matrices. There is a very good reason for this. A 4×4 matrix is capable of not only storing rotation values, but they can also store the translation, or movement values, at the same time. This eliminates the need to keep track of two separate sets of values for rotation and translation.<\/p>\n

Individual elements of a matrix are denoted by the notation a^ The a is standard notation, the i is the number of the row the element resides in, and the j is the number of the column. Therefore, a matrix could be written as shown in Figure 1.2.<\/p>\n\n\n\n\n
\n

\u00ae11<\/p>\n<\/td>\n

\n

\u041912<\/p>\n<\/td>\n

\n

\u041913<\/p>\n<\/td>\n<\/tr>\n

\n

&21<\/p>\n<\/td>\n

\n

3.22<\/p>\n<\/td>\n

\n

\u042d23<\/p>\n<\/td>\n<\/tr>\n

\n

\u042d31<\/p>\n<\/td>\n

\n

\u042d32<\/p>\n<\/td>\n

\n

a33<\/p>\n<\/td>\n<\/tr>\n<\/table>\n

Figure 1.2 A 3×3 matrix drawn using matrix notation. Note that the first subscript represents the row and the second subscript represents the column of the element.<\/p>\n","protected":false},"excerpt":{"rendered":"

Just what is a matrix you ask? Well, simply put, a matrix is a rectangular array of numbers. A few examples of matrices are shown in Figure 1.1. You know what they look like, but just what are they good for? Well, mathematicians like to use them to represent systems of linear equa\u00adtions. Using matrix […]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[7],"tags":[],"_links":{"self":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts\/32"}],"collection":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/comments?post=32"}],"version-history":[{"count":0,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/posts\/32\/revisions"}],"wp:attachment":[{"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/media?parent=32"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/categories?post=32"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/3dbym.ru\/wp-json\/wp\/v2\/tags?post=32"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}