开发者

UIAccelerationValue angle

开发者 https://www.devze.com 2022-12-30 02:49 出处:网络
(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 be
  • (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 anyo开发者_如何学运维ne help me ?

Thanks in advance.....


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

0

精彩评论

暂无评论...
验证码 换一张
取 消