Degree between vector and point

26 Views Asked by At

I have a vector and a point $(x, y)$. The vector starts from $(0, 0)$ and goes to $(x_1, y_1)$. $x$, $y$, $x_1$, $y_1$ are known. How can I get the degree that vector should rotate clockwise to face this point? Scheme

1

There are 1 best solutions below

2
On BEST ANSWER

You have an another vector $\vec A$ which joins $(0,0)$ and $(x,y)$. So now simply calculate the angle between this factor and your vector using dot product. You have: $ cos \theta = \frac{xx_1+yy_1}{\sqrt{x^2+y^2}\sqrt{x_1^2+y_1^2}}$ Where $\theta$ is angle between the two vectors