Angle { public static final double find(double x1, double y1, double x2, double y2) { double numer = Math.abs(y1 - y2); double denom = Math.hypot(x1 - x2, numer); double result = Math.acos(numer / denom); boolean y2Small = y2 < y1; boolean x2Small = x2 < x1; if (y2Small && x2Small) { result += Math.PI; } else if (y2Small && !x2Small) { result += HALF_PI; } else if (x2Small) { result += PI_AND_HALF; } return result; }  static final double find(double x1, double y1, double x2, double y2); static final double find(LatLonPoint point1, LatLonPoint point2); static final double find(Point point1, Point point2); static final double find(Coordinate coord1, Coordinate coord2);  }
@Test public void testFind_upper_right() { double x1 = 25.0; double y1 = 45.0; double x2 = 75.0; double y2 = 100.0; double expResult = Math.toRadians(42.273689); double result = Angle.find(x1, y1, x2, y2); assertEquals(expResult, result, 0.000001); }
@Test public void testFind_upper_left() { double x1 = 25.0; double y1 = 45.0; double x2 = -25.0; double y2 = 100.0; double expResult = Math.toRadians(312.273689); double result = Angle.find(x1, y1, x2, y2); assertEquals(expResult, result, 0.000001); }
@Test public void testFind_lower_left() { double x1 = 75.0; double y1 = 100.0; double x2 = 25.0; double y2 = 45.0; double expResult = Math.toRadians(222.273689); double result = Angle.find(x1, y1, x2, y2); assertEquals(expResult, result, 0.000001); }
@Test public void testFind_lower_right() { double x1 = 75.0; double y1 = 100.0; double x2 = 125.0; double y2 = 45.0; double expResult = Math.toRadians(132.273689); double result = Angle.find(x1, y1, x2, y2); assertEquals(expResult, result, 0.000001); }