iphone sdk CGAffineTransform获取对象的旋转角度 [英] iphone sdk CGAffineTransform getting the angle of rotation of an object

查看:309
本文介绍了iphone sdk CGAffineTransform获取对象的旋转角度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何计算任何给定对象(即uiimageview)的旋转角度?

how do i calculate the angle of rotation for any given object (ie a uiimageview)?

推荐答案

t,因为变换可以包括将图像变成平行四边形并且不再定义旋转角的偏斜操作。

Technically you can't, because the transform can include a skew operation which turns the image into a parallelogram and the rotation angle isn't defined anymore.

,因为旋转矩阵生成

 cos(x)  sin(x)   0
-sin(x)  cos(x)   0
   0        0     1

您可以使用

return atan2(transform.b, transform.a);

这篇关于iphone sdk CGAffineTransform获取对象的旋转角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆