# Android：Matrix – > preconcat和postconcat有什么区别？

• postRotate
• preRotate
• setRotate

### 3 Solutions collect form web for “Android：Matrix – > preconcat和postconcat有什么区别？”

``[320] [240] [ 1]` `

` `[1.5 0 0] [ 0 1.5 0] [ 0 0 1]` `

` `[480] [360] [ 1]` `

` `[1 0 -320] [0 1 -240] [0 0 1]` `

` `[320*1 + 1*-320] [0] [240*1 + 1*-240] = [0] [ 1*1 ] [1]` `

` `matrix: float[] values ={1.2f,0.5f,30,0.5f,1.2f,30,0,0,1}; //as we all know, the basic value in matrix,means no transformation added matrix2: float[] values2 ={1f,0,0,0,1f,0,0,0,1}; Let's say our matrix values are the values above.` `

1，当我们做如下的转换：

` `matrix.preTranslate(-50, -50); is equals to do sequence transformation to matrix2 above like below: matrix2.postTranslate(-50, -50); matrix2.postSkew(0.5f/1.2f,0.5f/1.2f);// note here matrix2.postScale(1.2f, 1.2f); matrix2.postTranslate(30, 30);` `

2，当我们做如下的转换：

` `matrix.preRotate(50); is equals to do sequence transformation to matrix2 like below: matrix2.postRotate(50); matrix2.postSkew(0.5f/1.2f,0.5f/1.2f); matrix2.postScale(1.2f, 1.2f); matrix2.postTranslate(30, 30);` `

3，当我们做如下的变换：

` `matrix.preScale(1.3f,1.3f); is equals to do sequence transformation to matrix2 like below: matrix2.postScale(1.3f,1.3f); matrix2.postSkew(0.5f/1.2f,0.5f/1.2f); matrix2.postScale(1.2f, 1.2f); matrix2.postTranslate(30, 30);` `

4，当我们做如下的转换：

` ` matrix.preSkew(0.4f,0.4f);` `

` ` matrix2.postSkew(0.4f,0.4f); matrix2.postSkew(0.5f/1.2f,0.5f/1.2f); matrix2.postScale(1.2f, 1.2f); matrix2.postTranslate(30, 30);` `
` `matrix: float[] values ={1.2f,0,30,0,1.2f,30,0,0,1}; matrix2: float[] values2 ={1f,0,0,0,1f,0,0,0,1};` `

1. 当我们做如下的转换：

` `matrix.preTranslate(-50, -50);` `

等同于对上面的matrix2进行序列转换，如下所示：

` `matrix2.postTranslate(-50, -50); matrix2.postScale(1.2f, 1.2f); matrix2.postTranslate(30, 30);` `
2. 当我们做如下的转换：

` `matrix.preRotate(50);` `

等同于对matrix2进行如下的序列转换：

` `matrix2.postRotate(50); matrix2.postScale(1.2f, 1.2f); matrix2.postTranslate(30, 30);` `
3. 当我们做如下的转换：

` `matrix.preScale(1.3f,1.3f);` `

等同于对matrix2进行如下的序列转换：

` `matrix2.postScale(1.3f,1.3f); matrix2.postScale(1.2f, 1.2f); matrix2.postTranslate(30, 30);` `

• 你如何旋转二维数组？
• 在Python中稀疏的3dmatrix/数组？
• 反转一个4x4matrix
• 炸弹algorithm
• 如何通过广播密集的1d数组元素乘以一个scipy.sparsematrix？
• R - 像素matrix的图像？
• Python（NumPy，SciPy），find一个matrix的零空间
• 如何在一列中对MATLAB中的二维数组进行sorting？
• 为什么MATLAB在matrix乘法中如此之快？
• numpymatrix向量乘法
• Java中的稀疏matrix/数组