private static float angleDeg ( final float ax , final float ay , final float bx , final float by ) { final double angleRad = Math . atan2 ( ay - by , ax - bx ) ; double angle = Math . toDegrees ( angleRad ) ; if ( angleRad < 0 ) { angle += 360 ; } return ( float ) angle ; }
Returns angle in degrees between two points