【问题标题】:pitch value is -90 degree to 90 degree when reading orientation from android从 android 读取方向时,pitch 值为 -90 度到 90 度
【发布时间】:2013-09-28 07:28:58
【问题描述】:

我正在读取手机的方向值,方位角和滚动数据都很好,因为它们是 -180 到 180,但是我在俯仰方面有问题,因为只有当我从 0 旋转手机时它是 -90 到 90度到 360 度。

SensorManager.getRotationMatrixFromVector(mRotationMatrix, event.values);
SensorManager.getOrientation(mRotationMatrix, orientationVals);
float azimuth = (float)Math.toDegrees(orientationVals[0]); 
float pitch = (float)Math.toDegrees(orientationVals[1]);
float roll = (float)Math.toDegrees(orientationVals[2]);
float deltaX = Math.abs(mLastOrientation[0] - azimuth);
float deltaY = Math.abs(mLastOrientation[1] - pitch);
float deltaZ = Math.abs(mLastOrientation[2] - roll);
if (deltaX < ORIENTATIONNOISE) azimuth = mLastOrientation[0];
if (deltaY < ORIENTATIONNOISE) pitch = mLastOrientation[1];
if (deltaZ < ORIENTATIONNOISE) roll = mLastOrientation[2];  
mLastOrientation[0] = azimuth;
mLastOrientation[1] = pitch;
mLastOrientation[2] = roll;

谁能帮忙。谢谢

【问题讨论】:

    标签: android android-sensors


    【解决方案1】:

    这让我觉得很正常。如果您考虑一下,俯仰本质上是设备坐标中的纬度,并且纬度的大小不能大于 90 度 - 在该点(也称为北极和南极),它会环绕并再次开始减小。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-05-08
      • 1970-01-01
      • 2011-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多