Given an angle and length, how do I calculate the coordinates

后端 未结 5 1533
太阳男子
太阳男子 2020-12-30 02:18

Assuming the upper left corner is (0,0) and I\'m given an angle of 30 degrees, a starting point of (0,300), a line length of 600, how do I calculate the ending point of the

5条回答
  •  旧巷少年郎
    2020-12-30 03:12

    You don't say what the angle is measured relative to, or indeed what direction your axes go. These will make a difference.

    You first need to convert from degrees to radians (multiply by PI and divide by 180). Then you need to take the sine and the cosine of your angle and multiply these by the length of the line. You now have two numbers for your coordinates, but it depends what directions your axes go and from where you're measuring your angles which of these values is the x coordinate and which is the y, and whether either of them needs to be negated.

提交回复
热议问题