10

enter image description here

So from what I understand from this picture, the box is stretched to twice its width. And it is then flipped from the x-axis. And then it is rotated 30 degrees anticlockwise.

So these three transformations are Scaling, then Reflection then Rotation.

How am I supposed to go about answering this problem. Also, it says which homogenous 2d matrix, this is confusing for me because when you convert cartesian coordinates to homogenous coordinates, you are going from 2d - 3d. This question is saying homogenous but it is a purely 2d transformation, I find this confusing.

Any help would be appreciated.

EDIT: Final matrices:

The scaling matrix is... $$\begin{bmatrix}2& 0& 0\\ 0& 1 & 0\\0& 0 & 1\end{bmatrix}$$ The translation matrix is... $$\begin{bmatrix}1& 0& 3\\ 0& 1 & -1\\0& 0 & 1\end{bmatrix}$$ And the Rotation matrix is...$$\begin{bmatrix}\cos(30) & -\sin(30) & 0\\ \sin(30) & \cos(30) & 0\\ 0 & 0 & 1 \end{bmatrix}$$

Is that right? Now you simply matrix multiply?

Malcolm
  • 1,095
Ogen
  • 2,295
  • 8
  • 34
  • 44

1 Answers1

6

You can't represent such a transform by a $2 \times 2$ matrix, since such a matrix represents a linear mapping of the two-dimensional plane (or an affine mapping of the one-dimensional line), and will thus always map $(0,0)$ to $(0,0)$.

So you'll need to use a $3 \times 3$ matrix, since you need to represent affine mappings. If you represent the point $[x,y]$ as the vector $(x,y,1)^T$, then the matrix $$ T_{u,v} = \begin{pmatrix} 1 & 0 & u \\ 0 & 1 & v \\ 0 & 0 & 1 \end{pmatrix} $$ represents the translation in the direction $[u,v]$, i.e. $$ T_{u,v} [x,y] = T_{u,v}(x,y,1)^T = (x+u,y+v,1) = [x+u,y+v] \text{.} $$

To find the representation of a linear mapping as a $3 \times 3$ matrix, simply take the $2\times 2$ matrix that represents the mapping in euclidean two-dimensional space, and embedd it into a $3 \times 3$ matrix like this $$ \begin{pmatrix} M & 0 \\ 0 & 1 \end{pmatrix} \text{.} $$ For example, you'd represent a rotation around the origin (which is a linear mapping) as $$ R_\varphi = \begin{pmatrix} \cos\varphi & -\sin\varphi & 0 \\ \sin\varphi & \cos\varphi & 0 \\ 0 & 0 & 1 \end{pmatrix} \text{.} $$ You can use normal matrix multiplication to combine the matrix representation of affice mappings - for example, to rotate around the point $[u,v]$, compute the product matrix $$ T_{u,v} R_\varphi T_{-u,-v} \text{,} $$ which simply says "shift the center of the rotation to the origin, rotate around the origin and shift back".

fgp
  • 21,438
  • So in that case wouldnt my 2x2 scaling matrix be $$\begin{bmatrix}2& 0& 0\ 0& 1& 0\0& 0& 1\end{bmatrix}$$ in 3x3 – Ogen Mar 19 '14 at 21:48
  • Depends. If you scale first, then yes, but you'll need to rotate by 120 degrees, not 30, because your scaling matrix scales the $x$-Axis. Personally, I'd put the $2$ into the second column of the second row, i.e. scale the $y$-Axis, then rotate by 30 degrees counter-clockwise (i.e., mathematically positive), and then translate. But that's just my preference, there are multiple ways to do this.. – fgp Mar 19 '14 at 21:53
  • 1
    @Clay On second thought, make that "scale, translate, rotate", i.e. rotate last. Then, all the parameters of these three transforms can be read directly from the picture. If you rotate first, you'll have to put a little bit of work into computing the translation vector. – fgp Mar 19 '14 at 21:55
  • What about the reflection? You say "scale translate rotate" but when I look at the picture, what I see is "scale, translate, reflect on x axis, then rotate 30 degrees." I'm having trouble seeing it any other way. – Ogen Mar 20 '14 at 04:15
  • 1
    I view that not as a reflection, but simply as a translation. In "scale, translate, rotate", the translation I have in mind moves the box 1 unit down and 3 units to the right. But you can view it as a reflection too, but then you one matrix more that you must multiply... – fgp Mar 20 '14 at 10:45
  • ahhhh ofcourse... Genius. Okay I'm going to put the matrices in an edit to see if they're right – Ogen Mar 20 '14 at 10:55
  • 1
    Ok I edited the question – Ogen Mar 20 '14 at 11:07
  • @Clay Looks fine, although you want want to either write the angle in radians, or at least mark them as being states in degrees by adding a degree sign. – fgp Mar 20 '14 at 11:10
  • Ok, thanks for the all the help. – Ogen Mar 20 '14 at 11:11
  • 1
    @Clay When multiplying, be carefull to use to correct order. Remember that $AB$ means applying $B$ first, and $A$ second if you're working with column vectors (which you do, otherwise your matrixes would need to be transposed). – fgp Mar 20 '14 at 11:13
  • So you're saying to Scale -> Translate -> Rotate. S, T and R, respectively, the multiplication would be R(TS)? – Ogen Mar 20 '14 at 11:15
  • 1
    @Clay Yes. You may drop the parenthesis, btw - matrix multiplication is associative, i.e. $A(BC) = (AB)C$. – fgp Mar 20 '14 at 11:22