I have a QTransform object and would like to know the angle in degrees that the object is rotated by, however there is no clear example of how to do this:
http://doc.trolltech.com/4.4/qtransform.html#basic-matrix-operations
Setting it is easy, getting it back out again is hard.
Assuming, that the transform ONLY contains a rotation it's easy: Just take the acos of the m11 element.
It still works if the transform contains a translation, but if it contains shearing or scaling you're out of luck. These can be reconstructed by decomposing the matrix into a shear, scale and rotate matrix, but the results you get aren't most likely what you're looking for.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With