我的问题是关于android.graphics.Camera
中的rotate
方法。在文档中,我看到了这些评论:
public void rotateX (float deg) Since: API Level 1
Applies a rotation transform around the X axis.
public void rotate (float x, float y, float z) Since: API Level 12
Applies a rotation transform around all three axis.
我的问题是:使用 rotate (float x, float y, float z) 和一系列 rotate* 方法之间有什么区别,例如这两个 fragment A 和 B:
一)
camera.rotate (x, y, z);
B)
camera.rotateX (x);
camera.rotateY (y);
camera.rotateZ (z);
最佳答案
重要性在于轮换的应用顺序。
例如,考虑一架向前飞行的飞机,它首先在其 Z 轴上旋转 90 度(滚动),然后在其 X 轴上旋转 90 度(俯仰)。结果是飞机现在向右飞行,右翼朝下。现在考虑以相反顺序进行的操作,先进行 90 度俯仰,然后进行 90 度横滚。飞机现在正在向上飞行,右翼指向前方(这些结果可能会因您的坐标系而异)。
camera.rotate 提供了一种快速且简单的函数,可以使用一个函数应用所有三个旋转。其余三个轮换函数的原因是考虑到开发人员希望按特定顺序应用一个或多个轮换的情况。
关于android - 旋转方法之间的区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14301424/