# What do I multiply in this matrix calculation to configure my touchscreen?

I use 2 displays (1920x1080 touchscreen on the left, 1440x900 on the right). If I ever use

``````xinput set-prop "Acer T230H" "Coordinate Transformation Matrix" 0.566 0 0 0 .71111 0 0 0 1
``````

(as matrix value)

``````0.566    0       0
0        0.71111 0
0        0       1
``````

the x-coordinate is caluclated correctly, but the y-coordinate is must be multiplyed by ~1.2 to be correct.

Where do i have to place my 1.2?

-

If you want to scale the y coordinate, you should multiply 0.71111 by your scaling factor 1.2. The general formula is:

if the matrix is

``````a b c
d e f
g h i
``````

then the formula is

``````new_x = (a * old_x + b * old_y + c) / (g * old_x + h * old_y + i)
new_y = (d * old_x + e * old_y + f) / (g * old_x + h * old_y + i)
``````

This is a projective transformation. In almost all cases (meaning, all cases unless your display is a beamer that projects skewly on a wall), you just need a linear transformation, so you set `g h i` to `0 0 1`.

If you're ever going to do more advanced stuff, then you should know that for the porpose of this calculation, old_x/new_x etc are in the range between 0 and 1.

-
I finally use 0.365 0 0 0 .635 0 0 0 0.64, how can 'i' be unused then? – Peter Rader Nov 21 '11 at 14:14
@Peter Rader: what happens if you change it? i'm pretty sure that it has no meaning apart from being useful when composing transformations. – Timo Kluck Nov 21 '11 at 16:52
Change what? if h=1 the vertical is scaled down, if i set g=1 the horizontal is scaled down. h=1 or g=1 will scale the x-position by 0.5 – Peter Rader Nov 22 '11 at 11:46
@PeterRader: you are right, I didn't realize they actually used it, because there is definitely no need for it. The transformation you're using right now is equivalent to 0.5703 0 0 0 0.992 0 0 0 1 – Timo Kluck Nov 25 '11 at 20:57