2009-06-18 260 views
1

奧拉夥計們,iPhone取向表現爲旋轉

This might not be the right place for this. Let me know where I should post if I should post it elsewhere. 

I want to get the orientation of the device. I am thinking I can use something like this: 

float fAngleX = atan2(acceleration.y, acceleration.z); 
float fAngleY = atan2(acceleration.x, acceleration.z); 
float fAngleZ = atan2(acceleration.y, acceleration.x); 


First, is my formula right? 
Second, is this going to work for the device? 
Third, I'm going back and forth about filtering out gravity. Any thoughts? 
Lastly, is there a better way to get the devices orientation expressed as rotation for all three axis? 

感謝名單

-isdi-

回答

0

只要你小心,你可以使用角度,但它可能會更容易直接使用向量。

你幾乎肯定會想要做過濾;一個簡單的低通會很好,但不要過濾出重力,因爲它設備的方向:)。