Source: http://www.cnblogs.com/TianFang/p/3920734.html
The basic two-dimensional transformations can include rotation, scaling, twisting, and four kinds of peaceful movement,
These geometric operations can be converted to some basic matrix operations:
These transformations are linear, but the translation operation is not linear and cannot be done by 2*2 matrix operation. To shift the point (2, 1) in the x direction by 3 units, pan it in the y direction by 4 units. You can do this by first using matrix multiplication and then using matrix addition.
Combining these basic operations, mathematicians unify them into a 3*3 matrix, which is stored in the following form:
Since the third column of the matrix that represents the affine transformation is always (0,0,1), most of the time the matrix is stored as a 2*3 array.
Origin of the transformation
The reference point of a two-dimensional transformation is very important, such as the following rotation results are quite different:
Of course, there is a special kind of transformation except. That's the translation transformation, no matter what the origin is, the result of the transformation is unchanged.
Composite transformations
The matrix of a composite transformation can be obtained by multiplying several individual transformation matrices, which means that any sequence of affine transformations can be stored in a single Matrix object.
It is important to note that the composite transforms are sequential, in general, rotated, scaled, and then panned, with the first scaling, then rotation, and then panning being different.
Inverse matrix
The inverse matrix of a matrix can be calculated according to certain operations, and the matrix can be used to find out the position of the new coordinate point in the original coordinate system. However, it is important to note that not all matrices are reversible, and the invertible matrix requires a non-singular matrix.
Online preview
Microsoft has a geometric transformation of the online preview of the page, can be very intuitive to help us understand these transformations, interested friends may wish to try.
Http://ie.microsoft.com/testdrive/Graphics/hands-on-css3/hands-on_2d-transforms.htm
Summary
Matrix operation is a very basic mathematical knowledge, in the graphics of the application is still very extensive, but the University of the time often do not know what to use, and now use the time but forgot what the principle. This article only introduces some basic concepts of matrix operations, the detailed content can refer to the following reference. The next article simply introduces the actual use of matrix transformations.
Resources:
- HTTP://MSDN.MICROSOFT.COM/ZH-CN/LIBRARY/8667DCHF (v=vs.110). aspx
- http://msdn.microsoft.com/zh-cn/library/ms750596 (v=vs.110). aspx
- http://www.zhangxinxu.com/wordpress/2012/06/css3-transform-matrix-%E7%9F%A9%E9%98%B5/
- Http://netclass.csu.edu.cn/NCourse/hep089/Chapter6/CG_Txt_6_011.htm
- http://www.zhangxinxu.com/wordpress/2012/06/css3-transform-matrix-%E7%9F%A9%E9%98%B5/
[Turn] matrix transformation of two-dimensional graphs (I.)--Basic concepts