Created
July 15, 2014 10:15
-
-
Save ixiyang/4c32c70a059711df8968 to your computer and use it in GitHub Desktop.
matrix preXXX and postXXX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
matrix代表一个3*3矩阵,其内容如下 | |
MSCALE_X MSKEW_X MTRANS_X | |
MSKEW_Y MSKEW_Y MTRANS_Y | |
MPERSP_0 MPERSP_1 MPERSP_2 | |
Matrix matrix=new Matrix(); | |
System.err.println(matrix.toShortString()); | |
matrix.postScale(2, 3); | |
System.err.println(matrix.toShortString()); | |
matrix.postTranslate(10, 10); | |
System.err.println(matrix.toShortString()); | |
计算过程如下 | |
2 0 0 1 0 0 2 0 0 | |
0 3 0 * 0 1 0 = 0 3 0 | |
0 0 1 0 0 1 0 0 1 | |
1 0 10 2 0 0 2 0 10 | |
0 1 10 * 0 3 0 = 0 3 10 | |
0 0 1 0 0 1 0 0 1 | |
matrix=new Matrix(); | |
System.err.println(matrix.toShortString()); | |
matrix.preScale(2, 3); | |
System.err.println(matrix.toShortString()); | |
matrix.preTranslate(10, 10); | |
System.err.println(matrix.toShortString()); | |
计算过程如下 | |
1 0 0 2 0 0 2 0 0 | |
0 1 0 * 0 3 0 = 0 3 0 | |
0 0 1 0 0 1 0 0 1 | |
2 0 0 1 0 10 2 0 20 | |
0 3 0 * 0 1 10 = 0 3 30 | |
0 0 1 0 0 1 0 0 1 | |
所以prexxx或者postxxx方法先在单位矩阵的基础上生成一个矩阵M'。方法中参数的值会被设置到对应的位置(见开头)。 | |
假定原始矩阵为M,则 | |
matrix.prexxx(a,b)=M*M' | |
matrix.postxxx(a,b)= M'*M | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
http://my.oschina.net/u/559701/blog/74245
http://www.useragentman.com/blog/2011/01/07/css3-matrix-transform-for-the-mathematically-challenged/