以弧度计算一个点绕另一点的旋转
我一周来一直在努力解决这个问题,并找到了解决方案。我所拥有的是二维空间中的 2 个点,我需要解决的是其中一个点围绕另一个点的旋转。幸运的是,附图会有所帮助,我需要能够计算的是 b 绕 a 的旋转值。
我发现了很多指向寻找点积等的东西,但我仍在寻找那个黄金解决方案:哦(
谢谢!
I have been trying to get this problem resolved for week and have get to come to a solution. What I have is 2 points in a 2d space, what I need to resolve is what the rotation of one is around the other. With luck the attached diagram will help, what I need to be able to calculate is the rotational value of b around a.
I have found lots of stuff that points to finding the dot product etc but I am still searching for that golden solution :o(
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
请参阅 http://msdn.microsoft.com/en-us/ Library/system.math.atan2.aspx 供参考。
See http://msdn.microsoft.com/en-us/library/system.math.atan2.aspx for reference.
猜测:
A guess:
我假设正东(沿 X 轴向右)的弧度为零,+x 指向右侧,+y 指向下方。
B 相对于 A 的方位角为
angle = Arctan2 [(A_y - B_y) / (B_x - A_x)]
使用适当的函数计算适当的象限(可能是
Math.Atan2
)I'll assume that due east (along the X axis, to the right) is zero radians, and that +x points to the right and +y points down.
The bearing of B with respect to A is
angle = Arctan2 [(A_y - B_y) / (B_x - A_x)]
Use the proper function to calculate the proper quadrant (probably
Math.Atan2
)