Find the new coordinates using a starting point, a distance, and an angle

Posted by dqhendricks on Programmers See other posts from Programmers or by dqhendricks
Published on 2012-12-14T01:34:02Z Indexed on 2012/12/14 5:18 UTC
Read the original article Hit count: 192

Filed under:
|
|

Okay, say I have a point coordinate.

var coordinate = { x: 10, y: 20 };

Now I also have a distance and an angle.

var distance = 20;
var angle = 72;

The problem I am trying to solve is, if I want to travel 20 points in the direction of angle from the starting coordinate, how can I find what my new coordinates will be?

I know the answer involves things like sin/cosin, because I used to know how to do this, but I have since forgotten the formula. Can anyone help?

© Programmers or respective owner

Related posts about JavaScript

Related posts about math