Calculate point, given x, y, angle, and distance

In general, if $\theta$ is the angle between the line of sight from the entity to the point and the positive $x$ axis, then $$ x=5\cos\theta,\quad\text{and}\quad y=5\sin\theta. $$ Here $\cos$ is the cosine function and $\sin$ is the sine function.

When calculating values of these, it is important to realize that the angle can be measured in various ways, the most common being degrees and radians. $360$ degrees is $2\pi$ radians. In general to convert $x$ degrees to radians, multiply $x$ by $\pi/180$.

You can use either measurement system for the angle, but when calculating $\sin$ and $\cos$ using a device, make sure you measure the angle as needed by that device.

In your example, with an angle of $45$ degrees, if you find $\sin(45^\circ)$ and $\cos(45^\circ)$ from a calculator, make sure the calculator is set to use degrees as the measure. Using Google's calculator (which by default uses radians), we must input $\sin(45\ \text{ degrees})$ and $\cos(45\ \text{ degrees})$. This returns

$$\sin(45^\circ)\approx.707\quad\text{and}\quad\cos(45^\circ)\approx.707.$$ Your point would then have $x$ coordinate

$\ \ \ \ \ x\approx5\cdot (0.707)=3.535$

and $y$-coordinate

$\ \ \ \ \ y\approx5\cdot( 0.707)=3.535$.

In radians, $45$ degrees is $45\cdot{\pi\over 180}={\pi\over 4}$ radians; and you could compute $\cos(\pi/4)$ and $\sin(\pi/4)$ using a device where angles are measured in radians. This of course will give approximately $.707$ in both cases as before.


If you are at point (x,y) and you want to move d unit in alpha angle (in radian), then formula for destination point will be:

xx = x + (d * cos(alpha))
yy = y + (d * sin(alpha))

Note: If angle is given in degree:

angle in radian = angle in degree * Pi / 180