问题描述
假设:将手机放平(与地面平行).
Assumption: the phone is held flat (parallel with the ground).
我正在使用 getRotationMatrix()
和 getOrientation(float [] R,float []值)
来获取方位角.在此假设下,方位角就是 values [0]
.
I am using getRotationMatrix()
and getOrientation (float[] R, float[] values)
to get the azimuth. Under this assumption, the azimuth is simply values[0]
.
文档说:
然后我检查了一下,当手机的y轴指向北时,方位角确实为 0 .
Then I checked, when my phone's y axis points to the North, the azimuth is indeed 0.
但是,问题来了:当我的手机的y轴指向 West 时,即我将手机逆时针旋转,使其从北向西指向,方位角是负!
However, here comes the problem: when my phone's y axis points to West, i.e. I rotated my phone counter-clockwise to make it point from North to West, the azimuth is negative!
从北方逆时针旋转角度不应该为正吗?
哪里出问题了?
推荐答案
否,如果Z的正方向指向天空,则当y轴指向West时,该角度为正.但是getOrientation中使用的坐标Z的正方向指向地球,因此,现在看来逆时针变为顺时针,因此West为负.
No, if the positive direction of Z points to the sky then when y axis points to West then the angle is positive. But the coordinate used in getOrientation the positive direction of Z points down to the earth, thus now what seems counter-clockwise becomes clockwise, so West is negative.
这篇关于Android getOrientation()返回方位角,是正数还是负数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!