You have coordinates of point, and a number. You need to calculate the coordinates of the new point, which are obtained as a result of moving the original point forward by a distance equal to a given number on the same straight line. The line is drawn through the original point and the origin of coordinates.
You will get three numbers: the x and y coordinates and the distance. Calculate new coordinates and round them before the output.
You've encountered a challenging problem — time to put your thinking cap on 💡🧢! The task statement and HINT should help you solve it; however, if this problem is too complex, you can postpone it and come back later to try and solve it.
Tip:
- You can find the angle using
atan. For the current task, it's pretty simple:tan = y / x. If you know thetan, you can find an angle by theatan:angle = atan(tan). - The adjacent leg is determined by the
angleanddistance:distance * cos(angle). - The opposite leg is like an adjacent, but you need to use a
sinfunction.