Matrix Structure for screen rotation
9,241
Judging from the question it is a standard coordinate transform matrix.
So:
⎡x_out⎤ ⎡ a b c ⎤ ⎡ x_in ⎤
⎜y_out⎥ = ⎜ d e f ⎥ * ⎜ y_in ⎥
⎣z_out⎦ ⎣ 0 0 1 ⎦ ⎣ z_in ⎦
with z_out
= z_in
= 1.
I.e.
x_out = a * x_in + b * y_in + c
y_out = d * x_in + e * y_in + f
The example matrix you gave for right rotation
⎡ 0 -1 1 ⎤
⎜ 1 0 0 ⎥
⎣ 0 0 1 ⎦
thus means
x_out = 1 - y_in
y_out = x_in
for rotating left it would be the other way around i.e.:
x_out = y_in
y_out = 1 - x_in
giving the matrix
⎡ 0 1 0 ⎤
⎜ -1 0 1 ⎥
⎣ 0 0 1 ⎦
Related videos on Youtube
Comments
-
rubo77 over 1 year
I can set my screen rotation to inverted with:
xrandr -o inverted xinput set-prop 'ELAN Touchscreen' 'Coordinate Transformation Matrix' -1 0 1 0 -1 1 0 0 1
and back to normal with:
xrandr -o normal xinput set-prop 'ELAN Touchscreen' 'Coordinate Transformation Matrix' 1 0 0 0 1 0 0 0 1
I found a HowTo here: https://wiki.ubuntu.com/X/InputCoordinateTransformation
So I guess for (90° to the right) it will be:# ⎡ 0 -1 1 ⎤ # ⎜ 1 0 0 ⎥ # ⎣ 0 0 1 ⎦ right='0 -1 1 1 0 0 0 0 1'
But What is the right 'Coordinate Transformation Matrix' to the left?
-
Johan E almost 10 yearsWouldn't it be [[0 1 0] [-1 0 1] [0 0 1]]. I.e.
x
andy
are still swapped but it changes which of them that is inverted. The inverted coordinate has -1 in the upper-left 2x2 and 1 to the right, while the non-inverted coordinate have 1 in the upper-left 2x2 and 0 to the right. -
rubo77 almost 6 yearsNote: by now the wiki page also includes the answer to the left matrix
-