I drew this picture to interpret my question.
I have the x and y axis for all the vertices before rotating the object. And I have the angle of rotation, how can I find the x and y axis for the vertices after rotating the object.
Thanks
I drew this picture to interpret my question.
I have the x and y axis for all the vertices before rotating the object. And I have the angle of rotation, how can I find the x and y axis for the vertices after rotating the object.
Thanks
When a point $(x,y)$ is rotated about the origin $(0,0)$ counterclockwise by an angle $\theta$, the coordinates of the new point $(x',y')$ are $$\begin{align} x'&=x\cos(\theta)-y\sin(\theta), \\ y'&=x\sin(\theta)+y\cos(\theta).\end{align}$$ Thus, when we rotate a point $(x,y)$ about another point $(p,q)$ counterclockwise by an angle $\theta$, we can compute the new point's coordinates by
To translate $(p,q)$ to the origin, we subtract $p$ from $x$-coordinates and $q$ from $y$-coordinates, and to undo the operation we add instead of subtract. Thus, for example, after translating $(p,q)$ to the origin, the coordinates $(x,y)$ of our point have become $(x-p,y-q)$.
Therefore, the new point's coordinates are $$\begin{align} x'&=(x-p)\cos(\theta)-(y-q)\sin(\theta)+p, \\ y'&=(x-p)\sin(\theta)+(y-q)\cos(\theta)+q.\end{align}$$ In your particular case, we can now see that the coordinates of the points $a$, $b$, $c$, and $d$ after rotation are $$\begin{align} a'&=((1-3)\cos(15)-(5-3)\sin(15)+3,(1-3)\sin(15)+(5-3)\cos(15)+3)\\\\ &=\left((-2)\left(\tfrac{1+\sqrt{3}}{2\sqrt{2}}\right)-(2)\left(\tfrac{-1+\sqrt{3}}{2\sqrt{2}}\right)+3,(-2)\left(\tfrac{-1+\sqrt{3}}{2\sqrt{2}}\right)-(2)\left(\tfrac{1+\sqrt{3}}{2\sqrt{2}}\right)+3\right)\\\\ &=(3-\sqrt{6},3+\sqrt{2})\\\\ &\approx(0.55051,4.41421)\\\\\\ b'&=((5-3)\cos(15)-(5-3)\sin(15)+3,(5-3)\sin(15)+(5-3)\cos(15)+3)\\\\ &=\left((2)\left(\tfrac{1+\sqrt{3}}{2\sqrt{2}}\right)-(2)\left(\tfrac{-1+\sqrt{3}}{2\sqrt{2}}\right)+3,(2)\left(\tfrac{-1+\sqrt{3}}{2\sqrt{2}}\right)-(2)\left(\tfrac{1+\sqrt{3}}{2\sqrt{2}}\right)+3\right)\\\\ &=(3+\sqrt{2},3+\sqrt{6})\\\\ &\approx(4.41421,5.44949)\\\\\\ c'&=((1-3)\cos(15)-(1-3)\sin(15)+3,(1-3)\sin(15)+(1-3)\cos(15)+3)\\\\ &=\left((-2)\left(\tfrac{1+\sqrt{3}}{2\sqrt{2}}\right)-(-2)\left(\tfrac{-1+\sqrt{3}}{2\sqrt{2}}\right)+3,(-2)\left(\tfrac{-1+\sqrt{3}}{2\sqrt{2}}\right)-(-2)\left(\tfrac{1+\sqrt{3}}{2\sqrt{2}}\right)+3\right)\\\\ &=(3-\sqrt{2},3-\sqrt{6})\\\\ &\approx(1.58579,0.55051)\\\\\\ d'&=((5-3)\cos(15)-(1-3)\sin(15)+3,(5-3)\sin(15)+(1-3)\cos(15)+3)\\\\ &=\left((2)\left(\tfrac{1+\sqrt{3}}{2\sqrt{2}}\right)-(-2)\left(\tfrac{-1+\sqrt{3}}{2\sqrt{2}}\right)+3,(2)\left(\tfrac{-1+\sqrt{3}}{2\sqrt{2}}\right)-(-2)\left(\tfrac{1+\sqrt{3}}{2\sqrt{2}}\right)+3\right)\\\\ &=(3+\sqrt{6},3-\sqrt{2})\\\\ &\approx(5.44949,1.58579)\\\\\\ \end{align}$$
Plotting these points in Mathematica demonstrates visually that our calculations were correct:
ListPlot[{{3 - Sqrt[6], 3 + Sqrt[2]}, {3 + Sqrt[2], 3 + Sqrt[6]},
{3 - Sqrt[2], 3 - Sqrt[6]}, {3 + Sqrt[6], 3 - Sqrt[2]}}, AspectRatio -> 1,
AxesOrigin -> {0, 0}, PlotMarkers -> {Automatic, Medium}, PlotStyle -> Blue]
I think you can move the origin to the point of center of the square first and then use a proper rotation matrix to find your new coordinates. In fact if the center of the square has coordinates $(x_0,y_0)$ in LHS picture, by shifting $(0,0)\to(x_0,y_0)$, every points in LHS picture with(X,Y) has $(X-x_0,Y-y_0)$ coordinates in RHS picture. Now use the proper rotation matrix noting that $\theta=15$. See http://en.wikipedia.org/wiki/Rotation_matrix
First, move your rectangle so that the center of rotation and origin overlaps. Now It's easy to compute rotation as point $(x,y)$ goes to $$(x\cos(\alpha) - y\sin(\alpha), x\sin(\alpha) + y\cos(\alpha))$$ And then move your rectangle back to the original position. We have $\sin(15^\circ)=\frac{\sqrt{3}-1}{2\sqrt{2}}$ and $\cos(15^\circ)=\frac{\sqrt{3}+1}{2\sqrt{2}}$ so for example for point $a$ we have $$(1,5) \to (-2,2) \to (-\sqrt{6},\sqrt{2}) \to (3-\sqrt{6}, 3+\sqrt{2})$$