Android的 - 得到一个矩阵的当前旋转矩阵、Android

2023-09-05 03:37:11 作者:少女的朝思暮想

我需要能够设置一个矩阵的旋转,而不是添加到它。我相信,以设置旋转的唯一方法是知道的矩阵的当前旋转

I need to be able to set the rotation of a matrix rather than add to it. I believe the only way to set the rotation is to know the current rotation of the matrix.

注: matrix.setRotate()不会做,因为矩阵需要保留其信息

Note: matrix.setRotate() will not do, because the matrix needs to retain its information.

推荐答案

你可以做的就是调用的GetValues​​ 和缓存的数值。当你想他们回来就叫 setValues​​方法在矩阵以后。

What you can do is call getValues and cache the values. Later when you want them back just call setValues on the matrix.

旋转矩阵与变换矩阵关系很好的解释这里

The rotation matrix and transform matrix relation well explained here