private float pointToAngle ( float x , float y , float centerX , float centerY ) { double diffX = x - centerX ; double diffY = y - centerY ; // Pass -diffX to get clockwise degrees order. double radian = Math . atan2 ( - diffX , diffY ) ; float angle = ( ( float ) Math . toDegrees ( radian ) + 360 ) % 360 ; // Add 90 because atan2 returns 0 degrees at 6 o'clock. angle += 90f ; return angle ; }
Calculates angle of touched point .