0

Take a look at the official documentation for libinput's coordinate transformation matrix: https://wayland.freedesktop.org/libinput/doc/1.1.0/group__config.html#ga09a798f58cc601edd2797780096e9804

Near the end it states that:

Note that any rotation requires an additional translation component to translate the rotated coordinates back into the original device space.

How are these translation components determined. The transformation matrix for rotating the coordinates 90 degrees anticlockwise is:

 0  1  0
-1  0  1
 0  0  0

The translation coordinates in this case are 0 and 1.

2
+100

This looks like straight linear algebra to me. I checked the link to see what you were talking about. The first image they have when the page starts on the subject of rotation is filled with cosines and sines. The thing to realize is that the cos(a), sin(a), -cos(a) etc all become 1's and 0's (possibly -1 also) when you're dealing with rotation in increments of 90 degrees. For me this is really a math question. Check out the wikipedia page on Rotation matrices as a ref: https://en.wikipedia.org/wiki/Rotation_matrix.

About the translation back to the original space; if the "origin" is not in the center, rotation moves some elements away from the original absolute position. This article talks more specifically about device mapping and computer graphics and includes information on the translation and also scaling factors (check the section on Affine transformations). https://en.wikipedia.org/wiki/Transformation_matrix

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.