0
$\begingroup$

Suppose I have a 2D matrix as such: $$\begin{bmatrix} 1 &0 &0\\ 0 &1 &0\\ 0 &0 &1\\ \end{bmatrix} $$

If I apply a rotation of 180 degrees and a scale of 2, what will my resultant matrix look like? Also, given another matrix (example below), how do I get the angle it was rotated and the scale?

$$\begin{bmatrix} 1.4 &0.12 &0\\ -0.12 &1.4 &0\\ 0 &0 &1.0\\ \end{bmatrix} $$ I apologise in advance- I'm not a math major and this is most definitely not homework. I just want to apply this knowledge in transforming images (I'm making an app). Thanks!

  • 0
    Rotation about an anticlockwise angle $\theta$ is given by $\begin{pmatrix}\cos\,\theta&-\sin\,\theta\\\sin\,\theta&\cos\,\theta\end{pmatrix}$, while scaling by a factor of $p$ in the horizontal and a factor of $q$ in the vertical is represented by $\begin{pmatrix}p&0\\0&q\end{pmatrix}$. So, in most cases, you have to specify the direction of rotation, and which of the two transformations will you be applying first. Luckily for you, since $p=q$ in your case, the order doesn't matter...2012-02-10
  • 0
    "Also, given another matrix (example below), how do I get the angle it was rotated and the scale?" - you'll want to look up what is called the QR decomposition.2012-02-10
  • 0
    thanks jm. so i guess getting the angle and scale is a pretty difficult process. what if we know that p and q will be the same all the time?2012-02-10
  • 0
    If you know the matrix is always of the form $\begin{pmatrix}p\,\cos\,\theta&-p\,\sin\,\theta\\p\,\sin\,\theta&p\,\cos\,\theta\end{pmatrix}$, then just take the square root of the sum of the squares of the entries in the first row to get $p$ (why?). Divide all the entries of the matrix by $p$ to obtain the rotation matrix.2012-02-10
  • 2
    Obligatory xkcd: http://xkcd.com/184/2012-02-10

1 Answers 1

1

A= $\begin{bmatrix} 1 &0 &0\\ 0 &1 &0\\ 0 &0 &1\\ \end{bmatrix} $

B$_{+180}$= $\begin{bmatrix} cos(180 )&sin(180) &0\\ -sin(180) &cos(180 ) &0\\ 0 &0 &1\\ \end{bmatrix} $

C$_{2,2}$= $\begin{bmatrix} 2 &0 &0\\ 0 &2 &0\\ 0 &0 &1\\ \end{bmatrix} $

ABC = $\begin{bmatrix} -2 &0 &0\\ 0 &-2 &0\\ 0 &0 &1\\ \end{bmatrix} $ (Assuming rotation is clockwise)