Windows 8 提供 various sensors适用于 Windows 应用商店应用程序。其中之一是OrientationSensor 。我真的不明白它的作用,或者更确切地说它与 Inclinometer 有什么不同。
MSDN 有一个相当简短的解释:
This sensor returns a rotation matrix and a Quaternion that can be used to adjust the user's perspective in a game application.
因此,它返回 3D 旋转的数学表示(大概?)对应于设备方向。但测斜仪本质上是做同样的事情,尽管数学表示不同:
This sensor returns pitch, roll, and yaw values that correspond to rotation angles around the x, y, and z axes, respectively.
我知道矩阵和四元数在某些情况下更可取,并且它们避免 gimbal lock 。但测斜仪也可以提供这一点。为什么有两个传感器呢?他们有什么区别?
最佳答案
警告:我不是该主题的专家,我的答案可能不准确,或者完全错误。
看起来它们都是硬件传感器的传感器融合——加速计、陀螺仪和磁力计。 (https://blogs.msdn.com/b/b8/archive/2012/01/24/supporting-sensors-in-windows-8.aspx)
根据http://msdn.microsoft.com/library/windows/apps/hh465294.aspx , “开发人员通常使用这些数据来控制复杂的游戏。”
此外,http://msdn.microsoft.com/en-US/library/windows/apps/hh465282.aspx说的是
The mathematics behind quaternions is fairly exotic in that it involves the geometric properties of complex numbers and mathematical properties of imaginary numbers, but working with them is simple, and frameworks like DirectX support them."
看起来 OrientationSensor 是一个方便的 API,在少数情况下它确实被证明很方便。
关于windows-8 - 方向传感器有什么作用?它与倾角仪有何不同?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17143983/