# What will be the new angle between the two 2d points if I rotate one point about another point by a certain angle

I have two points $(x_1,y_1)$ and $(x_2,y_2)$. Using dot product I have calculated the angle between the two. Let's call this angle $A$. Now, I want to rotate $(x_2,y2)$ around $(x1,y1)$ such that resulting angle between the $(x_1,y_1)$ and $(x'_2, y'_2)$ becomes $5^\circ$. So, I continue like below. Find angle of rotation which will $A' =(A -5)$. So new points will be

$$x'_2 = \cos(A')(x_2 - x_1) - \sin(A') (y_2 - y_1) + x_1$$ $$y'_2 = \sin(A')(x_2 - x_1) + \cos(A') (y_2 - y_1) + y_1$$

Is this correct?

if it's correct then the problem is that if I recalculate the angle using dot product between $(x_1,y_1)$ and $(x'_2,y'_2)$ then the resulting angle is not $5^\circ$. How can his be. My understanding of rotation and resulting new angle is wrong?

• The angle $A'=(A-5)$ gives a rotation around the origin, not around $(x_1,y_1)$ – Emilio Novati Sep 24 '17 at 20:15
• Then, what should be the angle of rotation around x1,y1. Or Alternatively,can you please help in detailing what should be the new point x',y' so that angle between x1,y1 and x',y' is 5 degree. – vik Sep 24 '17 at 20:26
• Have you drawn a picture? Seems to me that if the two points are very close, in comparison to their distance from the origin, there may be no solution to your problem. – Lubin Sep 24 '17 at 23:32

So, if I well understand your problem, you have two vectors: $\vec p_1=(x_1.y_1)^T$ and $\vec p_2=(x_2.y_2)^T$ and you want a new vector $\vec p=(x,y)$ such that.
$$\begin{cases} \frac{\vec p_1 \cdot \vec p}{|\vec p_1| |\vec p|}=\cos 5°\\ |\vec p -\vec p_1|=|\vec p_2-\vec p_1| \end{cases}$$ this is a system in the two unknowns $(x,y)$ and solvin it you find the vector $\vec p$.
Now you can find the rotation angle $\theta$ of $\vec p_1$ around $p_1$ that gives $R_\theta(\vec p_2)=\vec p$ as the angle such that:
$$\cos \theta =\frac{(\vec p-\vec p_1)\cdot(\vec p_2-\vec p_1)}{|\vec p-\vec p_1|^2}$$