# Get the rotation of a point caused by applying a given affine transformation

I was wondering if it is possible to get a point's specific rotation after it has been applied a certain but entirely arbitrary affine transformation $F$. To make things more clear, I have an affine transformation:

$F=\begin{bmatrix}a && b && t_1 \\ c && d && t_2 \\ 0 && 0 && 1\end{bmatrix}$

And a point $\vec{v}=<x,y,1>$.

I know it is difficult to decompose the affine transformation when the order of the individual transformations is not known. I'm wondering if it still is possible to get the rotation of a specific point, because I know the new point will be positioned at $\begin{bmatrix} a x + b y + t_1 \\ cx + dy + t_2 \\ 1\end{bmatrix}$. Now I was being very naive and thought that maybe this would work:

$\theta_\vec{v}=lim_{h\to0}{rot(\begin{bmatrix}ax+by+t_1 \\ cx+dy+t_2\end{bmatrix},\begin{bmatrix}a(x+h)+by+t_1 \\ c(x+h)+dy+t_2\end{bmatrix})}$

Where $rot(\vec{v_1},\vec{v_2})$ could be defined as $acos(\frac{\vec{v_1}\cdot{\vec{v_2}}}{\lvert{\vec{v_1}}\rvert.\lvert{\vec{v_2}}\rvert})$, yielding:

$acos(\frac{(ax+by+t_1)(a(x+h)+by+t_1)+(cx+dy+t_2)(c(x+h)+d(y+h)+t2)}{\sqrt{(ax+by+t_1)^2+(dx+cy+t_2)^2}\sqrt{(a(x+h)+b(y+h)+t_1)^2+(d(x+h)+cy+t_2)^2}})$.

I tried to solve the equation and run it through my program but didn't get the expected result. Is there anything I'm doing wrong?

### Update

Thanks to TL Davis, I noticed a mistake in my equations. It should be $\theta_\vec{v}=lim_{h\to0}{rot(\begin{bmatrix}ax+by+t_1 \\ cx+dy+t_2\end{bmatrix},\begin{bmatrix}a(x+h)+by+t_1 \\ c(x+h)+dy+t_2\end{bmatrix})}$. If I have the time I'll see if that works.

### Related

• Do you know that your transformation is a rigid motion or a conformal motion, or might it really be an arbitrary affine transformation? If you have an arbitrary affine transformation, you have to settle on what "atomic" transformations you're willing to consider (translations, rotations, and homographies certainly, but also something like axis scalings and axis-oriented shears). This is potentially thorny because you can't get by without some way of converting non-orthogonal lines to orthogonal, but by admitting these transformations you may be able to decompose a rotation in a non-unique way. – Andrew D. Hwang Jun 27 '17 at 11:02
• Thanks for your comment. Ideally, I don't know anything about the transformation beforehand, so that the user is free to choose his or her matrix. It could be shears, rotations, anything really. Are you suggesting that it is impossible like this? Could you perhaps expand on that last sentence? – samvv Jun 27 '17 at 11:08
• If $a$ and $b$ are real, then$$\begin{pmatrix}1 & a \\ 0 & 1\end{pmatrix} \begin{pmatrix}1 & 0 \\ b & 1\end{pmatrix} = \begin{pmatrix}1 + ab & a \\ b & 1\end{pmatrix}$$is a product of shears. If $a + b + a^{2}b = 0$ (e.g., $a = 1$ and $b = -\frac{1}{2}$), the columns of the product are orthogonal, and can be scaled (separately) to have unit length. This expresses a non-trivial rotation as a composition of axis-oriented shears and scalings. – Andrew D. Hwang Jun 27 '17 at 11:19
• Ok I think I understand, thanks! I will toy around with it later today to see if it works. – samvv Jun 27 '17 at 13:47
• What is $h$, where did it come from? – T L Davis Jul 6 '17 at 0:11