如何将一个三维加速度转换成旋转? [英] How to convert a 3D acceleration into a rotation?
问题描述
我有一个程序,它利用了Windows Phone 7的加速度计,我需要检测装置的转动是什么。我的X,Y,Z的加速度,并需要以某种方式弄清楚基于关的,该电话的取向。这怎么可能实现呢? (旋转值应在度)
I have a program which utilizes an accelerometer in the Windows Phone 7, and I need to detect what the rotation of the device is. I have X, Y, Z accelerations, and need to somehow figure out the orientation of the phone based off of that. How can this be accomplished? (Rotation values should be in Degrees)
推荐答案
虽然我在iPhone上它应该基本上是相同的问题的工作。硬件需要一个陀螺仪传感器来描述的旋转,特别是那些在平行于重力(我们称之为Z,X是合适的,y是向上)。如果设备平放在桌上,你身边这个Z轴旋转,只有微小的测量加速度由离心力产生的。所以,你可以得到有关旋转的一些信息,但你是有限的:
Although I am working on iPhone it should basically the same problem. Your hardware needs a gyroscope sensor to describe rotations, especially those in parallel to gravity (let's call this z, x is right and y is up). If the device lays flat on the table and you rotate around this z-axis, there are only tiny accelerations measured resulting from centrifugal forces. So you can get some information about rotation, but you are limited in:
1),用户必须持有特殊的方式在设备为你正确地检测旋转
1) Users have to hold the device in specific manner for you to detect the rotation properly
2),即使你拿到了45度的地面最好的情况下,这是很难让所有3个维度。你是最好,如果你只能在2旋转方向限制的检测。
2) Even if you got the best case of 45 degree to ground, it is very hard to get all 3 dimensions. You are better off, if you can limit detection on 2 rotational directions only.
3)您只能要么旋转或翻译,但与直线运动的旋转相结合的检测,同时是相当困难的。
3) You are limited to either rotations or translations, but combining detection of rotations with linear motions simultaneously is pretty hard.
结论:对于一个赛车游戏强制用户器件保持一定的角度,限制在z旋转的方向盘和如其他方向电源幻灯片或什么的。
Conclusion: For a racing game force users to hold the device in certain angle, limit on z-Rotation for steering wheel and some other direction for e.g. power slides or whatever.
这篇关于如何将一个三维加速度转换成旋转?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!