1public double getAngleFromPoint(Point firstPoint, Point secondPoint) {
2
3 if((secondPoint.x > firstPoint.x)) {//above 0 to 180 degrees
4
5 return (Math.atan2((secondPoint.x - firstPoint.x), (firstPoint.y - secondPoint.y)) * 180 / Math.PI);
6
7 }
8 else if((secondPoint.x < firstPoint.x)) {//above 180 degrees to 360/0
9
10 return 360 - (Math.atan2((firstPoint.x - secondPoint.x), (firstPoint.y - secondPoint.y)) * 180 / Math.PI);
11
12 }//End if((secondPoint.x > firstPoint.x) && (secondPoint.y <= firstPoint.y))
13
14 return Math.atan2(0 ,0);
15
16}//End public float getAngleFromPoint(Point firstPoint, Point secondPoint)
17