开发者

iPhone, how to calculate iPhone device three axis angle via UIAcceleration?

开发者 https://www.devze.com 2023-01-06 20:26 出处:网络
as topic, I am try to use the code as follows : xAngle = 90.0 *x; yAngle =90.0开发者_如何学Go* y;

as topic,

I am try to use the code as follows :

xAngle = 90.0 *x; yAngle = 90.0开发者_如何学Go* y; zAngle = 90.0* z;

but seem it is not right (x,y,z is the UIAcceleration attributes x, y and z)

am I miss some thing in this algorithm ?

thanks for your help

Best .


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)
0

精彩评论

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