2009-06-18 11 views
1

Ola Folks,iPhone Orientation Exprimé en rotation

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? 

Thanx

-isdi-

Répondre

1

Pour donner la rotation du dispositif en trois chiffres comme ça, est en réalité ambiguë. Ce genre de chose peut devenir assez confus. Je pense que cela pourrait être le meilleur endroit pour commencer:

0

Tant que vous êtes prudent, vous pouvez utiliser des angles, mais il serait probablement plus facile d'utiliser les vecteurs directement.

Vous aurez certainement envie de faire du filtrage; un simple passe-bas serait bien, mais ne filtre pas la gravité, car est l'orientation de l'appareil :).