How do I calculate the Rotation in Radians around Z-axis by giving a CATransform3D struct as the input?
basically what I need is the other way round of CATransform3DMakeRotation
.
How do I calculate the Rotation in Radians around Z-axis by giving a CATransform3D struct as the input?
basically what I need is the other way round of CATransform3DMakeRotation
.
It depends on what axis you are doing the rotation on.
Rotation about the z-axis is represented as:
so angle should be a = atan2(transform.m12, transform.m11);
Rotation about x-axis:
Rotation about y-axis:
If the transform is attached to a layer, then you can get the value of the rotation like follows:
From the documentation: