tags:

views:

67

answers:

1

Hi,

- (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration 

Using the above method we got an acceleration value of (x and y and z).Now i want to find angle between (x and y) and (y and z) and (z and x).How can i do this?

Can anyone help me ?

Thanks in advance.....

A: 

If your acceleration vector is a = (x, y, z), then the angles between this vector and the three axes are given by:

cos (angleXaxis) = x / sqrt(x^2 + y^2 + z^2)

cos (angleYaxis) = y / sqrt(x^2 + y^2 + z^2)

cos (angleZaxis) = z / sqrt(x^2 + y^2 + z^2)

To get the angles themselves you'll need to use the inverse cos function

pheelicks
Sorry for the late replay pheelicks.. I want to show angles when the ipod is over the air.
dragon
I want to show angles like in the Advanced Bubble Level Free application
dragon
My answer should do the trick
pheelicks