Questions tagged «atan2»

15
如何将atan2()映射到0-360度
atan2(y, x) 在180°处具有不连续性,顺时针方向切换为-180°..0°。 如何将值的范围映射到0°..360°? 这是我的代码: CGSize deltaPoint = CGSizeMake(endPoint.x - startPoint.x, endPoint.y - startPoint.y); float swipeBearing = atan2f(deltaPoint.height, deltaPoint.width); 给定startPoint和endPoint,这两个XY点结构都在计算滑动触摸事件的方向。该代码适用于iPhone,但支持的任何语言atan2f()都可以。
108 math  quartz-2d  atan2 
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.