求一条水平线旋转度数的方程
嘿,所以我有一个对象的中心,我正在以该中心为起点绘制一条线,然后将鼠标定位到它的末端。
如何找到第二个点 (?,?) 围绕静止的第一个点 (0,0) 的旋转程度?
注意:如果第二个点是 (1, 0),它将旋转 0 度。
hey so I have a center of an object and i'm making a line with this center as the start of it, and the mouse position the end of it.
How do I find how rotated the second point (?,?) is around the stationary first point (0,0) ?
Note: if the second point were (1, 0) it would be roated 0 degrees.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果旋转角度为
a
,第二个点为(x,y)
,则:If the angle of rotation is
a
, and the second point is(x,y)
then:还记得索卡托亚吗? ;) 您可以使用反正切(通过标准
atan2()
函数)来确定原点和任意点之间的直线的角度:Remember SOHCAHTOA? ;) You can use the arctangent (via the standard
atan2()
function) to determine the angle of the line between the origin and an arbitrary point: