# xslant mathematically

How is the xslant coordinate transformation operation of tikz defined mathematically?

For example, let A = (x_0, y_0) and xslant = k. What is the mathematical expression for the transformed coordinate B = (x_1, y_1)?

I want to understand how the pgf manual example works:

\begin{tikzpicture}
\draw[help lines] (0,0) grid (3,2);
\draw                (0,0) -- (1,1) -- (1,0);
\draw[xslant=2,blue] (0,0) -- (1,1) -- (1,0);
\draw[xslant=-1,red] (0,0) -- (1,1) -- (1,0);
\end{tikzpicture}


• For me, that looks like a shear at first glance. – Ronny Dec 14 '14 at 7:41
• In my opinion, it is x_1=x_0+k, y_1=y_0 – karlkoeller Dec 14 '14 at 7:43
• @karlkoeller: it is not. That would be xshift. – Mappi Dec 14 '14 at 8:19
• x_1=x_0+k*y_0 and y_1=y_0 – Mark Wibrow Dec 14 '14 at 8:27

As Mark Wibrow says in his comment xslant=k replace x by x+k*y.
So it is a shortcut to cm={1,0,k,1,(0,0)}.

\begin{tikzpicture}[myxslant/.style={cm={1,0,#1,1,(0,0)}}]
\draw[help lines] (0,0) grid (3,2);
\draw                (0,0) -- (1,1) -- (1,0);
\draw[myxslant=2,blue] (0,0) -- (1,1) -- (1,0);
\draw[myxslant=-1,red] (0,0) -- (1,1) -- (1,0);
\end{tikzpicture}


NOTE : There is a bug in the documentation of cm (PGF 2.0, 2.1 and 3.0): the matrix is the transpose of what it claims.

• I think that bug is there since v2.00 (which is I guess more than 5 years ago) – percusse Dec 14 '14 at 11:20
• @percusse It was not reported as bug before, I think. May be in 3.1 it will be no more ;) – Kpym Dec 14 '14 at 11:32
• I think there were two If I remember correctly ;) – percusse Dec 14 '14 at 11:45
• @percusse wow ! I was not able to find this reports when I did this one. May be the third will be the decisive one ;) – Kpym Dec 14 '14 at 11:49