Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/201.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Matrix,getValues()返回什么?_Android_Path_Matrix - Fatal编程技术网

Android Matrix,getValues()返回什么?

Android Matrix,getValues()返回什么?,android,path,matrix,Android,Path,Matrix,我在计算以下代码pMeasure=PathMeasure,m=Matrix的返回值时遇到问题,distCount是沿路径的距离 pMeasure.getMatrix(distCount, m, 0x01 | 0x02); m.getValues(float[] values) float[2]和float[5]分别是位置x和y,但我无法计算出其余的位置 再次感谢您的帮助。摘自: 公共静态最终int MPERSP_0 常量值:6(0x00000006) 公共静态最终int MPERSP_1 常

我在计算以下代码pMeasure=PathMeasure,m=Matrix的返回值时遇到问题,distCount是沿路径的距离

pMeasure.getMatrix(distCount, m, 0x01 | 0x02); 
m.getValues(float[] values)
float[2]和float[5]分别是位置x和y,但我无法计算出其余的位置

再次感谢您的帮助。

摘自:

公共静态最终int MPERSP_0
常量值:6(0x00000006)

公共静态最终int MPERSP_1
常量值:7(0x00000007)

公共静态最终int MPERSP_2
常量值:8(0x00000008)

公共静态最终整数MSCALE\u X
常量值:0(0x00000000)

公共静态最终int MSCALE_Y
常量值:4(0x00000004)

公共静态最终int MSKEW_X
常量值:1(0x00000001)

公共静态最终int MSKEW_Y
常量值:3(0x00000003)

公共静态最终整数MTRANS\u X
常量值:2(0x00000002)

公共静态最终整数MTRANS\u Y
常量值:5(0x00000005)


Android Matrix使用skia及其row MARY,这意味着索引如下

0  1  2  
3  4  5
6  7  8
我对比OpenGL使用这样的索引

0  3  6
1  4  7
2  5  8
就矩阵位置而言,“含义”是相同的

a  b  tx
c  d  ty
0  0   1
a、 b、c、d同时对缩放和旋转进行编码。tx/ty编码转换。如果不使用m.getValues(VAL);然后vals[2]==tx,vals[5]==ty,其余的是直接向前的。提取翻译的最佳方法是生成向量

float[] point = {0, 0};
然后把它画出来,看它在哪里结束,这就是你的翻译(确切地说是(tx,ty)。在极少数情况下,它不是

获取第二个点的比例贴图的步骤

float[] point2 = {1, 0};

现在取差rel=(点-point2)得到向量的长度,这就是你的尺度。要提取旋转,归一化rel,得到标准角度很简单。

谢谢你,但是透视在这方面意味着什么?老实说,我不知道。我打赌这些值是保留的,它们存在的原因可能是为了完成矩阵。在这里你会发现更多的信息NFO关于这个主题:Android使用SKIa,我检查了Android的矩阵类的源代码,在它的C++核心中,它只是GLUE矩阵,用SkMatrix。矩阵是3x3行的主要。由于这个McSeLayX/Y实际上不是刻度。只要没有旋转涉及,它就是刻度。如果矩阵编码旋转,你需要做额外的数学运算来计算TH。e scale.MPERSP用于计算“z”坐标,默认情况下z=1。如果z!=1,则x=x/z;y=y/z;z=z/z=1。一般来说,您不需要担心z。它就像opengl 4x4 for 3D,除了android上的3x3 for 2D