Move point in cartesian coordinate through distance in the given direction

6.8k views Asked by At

I have a point in cartesian coordinate system for example : x = 3 & y = 5

And I want to get new coordinate of this point after a move through a distance in the given direction (in degrees).

How I can do for get new x and new y ?

1

There are 1 answers

4
MBo On BEST ANSWER

Well-known formulas from the school geometry:

new_x = x + distance * Math.Cos(angle_degrees * Math.Pi / 180)
new_y = y + distance * Math.Sin(angle_degrees * Math.Pi / 180)

Note that angle_degrees = "given direction" is measured from the positive x-axis moving toward the positive y-axis