Android getOrientation()返回方位角,是正数还是负数? [英] Android getOrientation() returns azimuth, positive or negative?

查看:141
本文介绍了Android getOrientation()返回方位角,是正数还是负数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设:将手机放平(与地面平行).

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].

以上所有三个角度均以弧度表示,正方向以逆时针方向.

All three angles above are in radians and positive in the counter-clockwise direction.

然后我检查了一下,当手机的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()返回方位角,是正数还是负数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆