Get a point by a given point, degree and distance

89 Views Asked by At

I have a point $(x_1, y_1)$, an angle $A$ and a distance $D$

How do I get the point $(x, y)$ which is $D$ unit away from $x_1, y_1$ with angle $A$.

enter image description here

In the right image, the answer will be $(x_1 - D\sin A, y_1 + D\sin A)$

And in the left one $(x_1 + D\sin (180-A), y1 + D\sin(180-A))$

Is there some kind of formula that could cover all cases $(A<90, 90<A<180, 180<A<270, 270<A<360$?

1

There are 1 best solutions below

3
On BEST ANSWER

The solution is $(x_1-D\cos A, y_1+D\sin A)$ for all angles $A$