从GO中的中心点找到一个特定角度的点
我希望能够使用中心点(x,y)和一个角度在距中心的给定距离处找到第二点(x2,y2)。
例如:
中心为0,0
角度为50度
距离为10,
下面的代码是错误的,试图解释此答案 https://math.stackexchange.com/questions/143932/calculate-point-point-point-given-given-gin--xy-xy-angle-ang-and-andance 不知道如何使用GO合并θ。
抱歉,我已经有很多年没有做过这种数学了,这个问题听起来可能很愚蠢。
x := math.Cos(50)
y := math.Sin(50)
x2 := x *10
y2 := x *10
如何使用Golang找到X2,Y2?任何帮助将不胜感激。
I want to be able to use a center point (x,y) and an angle to find a second point (x2,y2) at a given distance from center.
For example:
Center is 0,0
Angle is 50 degrees
Distance is 10
The code below is wrong and trying to interpret this answer https://math.stackexchange.com/questions/143932/calculate-point-given-x-y-angle-and-distance however I have no idea how to incorporate the θ using Go.
Sorry I have not done this kind of math for many years and the question may sound stupid.
x := math.Cos(50)
y := math.Sin(50)
x2 := x *10
y2 := x *10
How do I find x2, y2 using Golang? Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GO数学功能使用弧度。您可能需要首先将度转换为 readians 。请参阅下面的示例:
输出:
The Go math functions use radians. You may need to convert from degrees to radians first. See the example below:
Output: