public static double calcRotationAngleInDegrees(PointF centerPt,PointF targetPt){
  double theta=Math.atan2(targetPt.y - centerPt.y,targetPt.x - centerPt.x);
  double angle=Math.toDegrees(theta);
  if (angle < 0) {
    angle+=360;
  }
  return angle;
}

public static double calcRotationAngleInDegrees ( PointF centerPt , PointF targetPt ) { double theta = Math . atan2 ( targetPt . y - centerPt . y , targetPt . x - centerPt . x ) ; double angle = Math . toDegrees ( theta ) ; if ( angle < 0 ) { angle += 360 ; } return angle ; }
calculates the angle from centerpt to targetpt in degrees . the return should range from [ 0 , 360 ) , rotating clockwise , 0 and 360 degrees represents east , 90 degrees represents south , etc . . . < p / > assumes all points are in the same coordinate space . if they are not , you will need to call swingutilities . convertpointtoscreen or equivalent on all arguments before passing them to this function .
