问题描述
如果我有720,720的图片,看起来像这样。
我发现很多计算结果假设原点是0,0(左上角),所以我得到的结果不正确。
我假设0始终是顶部,而不是旋转。
可能会更清晰: (Math.atan2(fromLeft - 360.0,360.0 - fromTop))+ 360.0)%360.0 添加一个360度转弯并应用模运算符给出正角,atan2不会。 If I have an image 720, 720 that looks like this.. How do I work out the angle of the touched x,y given that the center x and y are 360, 360A lot of calculations I see for this assume the origin is 0,0 (which is top left) so I get incorrect results.I am assuming 0 is always to the top and not rotated. May be clearer this way: Adding a 360 degree turn and applying the modulo operator gives you the positive angle, which atan2 does not. 这篇关于从圆心找出一个点的角度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
/ code>
(Math.toDegrees( Math.atan2(fromLeft - 360.0, 360.0 - fromTop) ) + 360.0) % 360.0