If I have a point on a standard grid with coordinates say:
$A_1=(1000,0)$
$A_2=(707,707)$
Is there a easy way to transfer this points to $\pm 120$ degrees from the origin $(0,0)$, and keeping the same distance? So for $A_1$, the result should be something like: $B_1=(800,-200);\ C_1=(800,-200)$
I can make this with triangles and calculate it but there should be some formula. I need a formula to use with software.
$\endgroup$ 12 Answers
$\begingroup$If $f$ is your angle, $(x,y)$ becomes $(x \cos f - y \sin f, y \cos f + x \sin f)$.
So with $f=120°$, $(x,y)$ becomes $(-\frac{1}{2}x-\frac{\sqrt{3}}{2}y, -\frac{1}{2}y+\frac{\sqrt{3}}{2}x)$.
And with $f=-120°$, $(x,y)$ becomes $(-\frac{1}{2}x+\frac{\sqrt{3}}{2}y, -\frac{1}{2}y-\frac{\sqrt{3}}{2}x)$.
$\endgroup$ 0 $\begingroup$In general, the rotation matrix of angle $\theta$ is $$r_\theta=\left(\begin{array}{cc}\cos\theta & -\sin\theta\\ \sin\theta & \cos\theta\end{array}\right).$$
In your case, $\theta=\pm120°$, so $\cos\theta=-1/2$ and $\sin\theta=\pm\frac{\sqrt 3}2$.
You just have to apply the matrix to the vector to get the image of the vector by the rotation.
$\endgroup$