Java examples for 2D Graphics:Angle
point To Angle
//package com.java2s; public class Main { public static double pointToAngle(double x, double y, double mCenterX, double mCenterY) { double deltaY = y - mCenterY; double deltaX = x - mCenterX; if (deltaX < 0) { return 180d + Math.atan(deltaY / deltaX) / Math.PI * 180; } else {//from ww w.j av a 2s .c o m return Math.atan(deltaY / deltaX) / Math.PI * 180; } } }