如何根据角度和距离获得坐标系中一个点的坐标 [英] How to get coordinates of a point in a coordinate system based on angle and distance

查看:437
本文介绍了如何根据角度和距离获得坐标系中一个点的坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我只有原点坐标(x,y)和从原点到点的角度以及从原点到点的距离时,如何获得坐标系中点的坐标?

How to get coordinates of a point in a coordinate system when all I have is the origin coordinates (x, y) and the angle from the origin to the point and the distance from the origin to the point?

推荐答案

您使用 Math.cos Math.sin 像这样:

You use Math.cos, Math.sin like this:

pointX = x + distance * Math.cos(angle)
pointY = y + distance * Math.sin(angle)

注意 Math.cos Math.sin 假设参数以弧度给出。如果你有以度为单位的角度,你可以使用 Math.cos( Math.toRadians(角度) )例如

Note that Math.cos and Math.sin assumes the argument is given in radians. If you have the angle in degrees, you would use Math.cos(Math.toRadians(angle)) for instance.

这篇关于如何根据角度和距离获得坐标系中一个点的坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆