I'm a programmer, with too little background in mathematics, and I am currently faced with the challenge of rotating an object on a 2 axis plane.
Something that is hopefully quite easy for you guys.
Anyway, to be concrete, what I need is, say I have an object (image) on an x,y plane and I know its exact coordinates, the corners, height, width, everything on that plane. Now its rotated by say X degrees. Is there a formula to get the new position of the four corners ? or one corner from which I will deduce all the other data I need ?
Thanks in advance to any good helping soul! Ariel
Take one of the corners, say it has coordinates $(x,y)$. Let $\alpha$ be the angle that $(x,y)$ makes with the positive $x$-axis and let $r=\sqrt{x^2+y^2}$. Then $x=r\cos\alpha$ and $y=r\sin\alpha$. Let's say you are rotating by an angle of $\theta$. Call this linear transformation $T_\theta:\mathbb{R}^2\to\mathbb{R}^2$. Then $T_\theta(x,y)$ makes an angle of $\alpha+\theta$ with the positive $x$-axis. Thus, $$T_\theta(x,y)=(r\cos(\alpha+\theta),r\sin(\alpha+\theta))=(x\cos\theta-y\sin\theta,x\sin\theta+y\cos\theta)$$
That is, $$T_\theta=\left[\begin{array}{c c} \cos\theta&-\sin\theta\\\sin\theta &\cos\theta\end{array}\right]$$