0
$\begingroup$

Let T:R2->R2 be the transformation that rotates each point in R2 about the origin through a counterclockwise positive angle $\theta$.

Is it possible to come up with a generic standard matrix for this transformation, by generic i mean which works for any (x,y) and any $\theta$ (positive/negative/anything)?

So far,i could do at best below analysis.

Since standard matrix for a transformation is given by [T(e1) T(e2)], where e1=(1,0) and e2=(0,1).

By assuming 0 < $\theta$ < $\pi$/2 and the point is in first quadrant, we can see that T(e1) = (cos $\theta$,sin $\theta$) and T(e2) = (-sin $\theta$,cos $\theta$) and hence the standard matrix for T is \begin{bmatrix}cos\theta&-sin\theta\\sin\theta&cos\theta\end{bmatrix}.

But does the above matrix works for any point and angle? If not, how would i generate one?

  • 0
    Yes. See https://en.wikipedia.org/wiki/Rotation_matrix.2017-01-27

2 Answers 2

0

Let $\Omega(x_0,y_0)$ be the center of rotation.

By considering it as the new origin of coordinates, point $M(x,y)$ is transformed into point $M'(x',y')$ if and only if $\vec{\Omega M'}=R(\vec{\Omega M})$, which gives

$$\binom{x'-x_0}{y'-y_0}=\begin{pmatrix}cos\theta&-sin\theta\\sin\theta&cos\theta\end{pmatrix}\binom{x-x_0}{y-y_0}$$

In other terms, the rotation with center $(x_0,y_0)$ and angle $\theta$ sending point $M(x,y)$ onto point $M'(x',y')$ is given by

$$\binom{x'}{y'}=\begin{pmatrix}cos\theta&-sin\theta\\sin\theta&cos\theta\end{pmatrix}\binom{x-x_0}{y-y_0}+\binom{x_0}{y_0}$$

0

It is not possible to perform such a generic transformation (rotation around given point) using a 2x2 matrix because the transformation is not linear. A good way to perform this transformation is given in JeanMarie's answer.

If you really want to apply the a transformation using a single matrix, then have a look at homogeneous coordinates (eg. http://planning.cs.uiuc.edu/node99.html).

For your transformation this would result in (though check for errors): $$ \left(\begin{array}{c} x' \\ y' \\ 1 \end{array}\right) = \left(\begin{array}{c} 1 & 0 & x_0 \\ 0 & 1 & y_0 \\ 0 & 0 & 1 \end{array}\right) \left(\begin{array}{ccc} \cos(\theta) & -\sin(\theta) & 0 \\ \sin(\theta) & \cos(\theta) & 0 \\ 0 & 0 & 1 \end{array}\right) \left(\begin{array}{ccc} 1 & 0 & -x_0 \\ 0 & 1 & -y_0 \\ 0 & 0 & 1 \end{array}\right) \left(\begin{array}{c} x \\ y \\ 1 \end{array}\right) = \left(\begin{array}{ccc} \cos(\theta) & -\sin(\theta) & -\cos(\theta) x_0 + \sin(\theta) y_0 + x_0 \\ \sin(\theta) & \cos(\theta) & -\sin(\theta) x_0 - \cos(\theta) y_0 + y_0 \\ 0 & 0 & 1 \end{array}\right) \left(\begin{array}{c} x \\ y \\ 1 \end{array}\right), $$ effectively translating to the origin, rotating, and translating back.