fail("PointR.FindBox not working properly");
}
@Test
public void testAngleinRadians() {
PointR p1 = new PointR(0, 0);
PointR p2 = new PointR(4, 2);
if (PointR.getAngleInRadians(p1, p2, true) != Math.atan2(2, 4))
fail("PointR pathlength calculation not working properly");
if (PointR.getAngleInRadians(p1, p2, false) != Math.atan2(2, 4))
fail("PointR pathlength calculation not working properly");
PointR p3 = new PointR(4, 0);
// -90 degrees is straight up
assertEquals(-Math.PI / 2.0, PointR.getAngleInRadians(p2, p3, false),
0.001);
// With positiveOnly
assertEquals((-Math.PI / 2.0) + (Math.PI * 2.0),
PointR.getAngleInRadians(p2, p3, true), 0.001);
PointR p4 = new PointR(4, 6);
// 90 degrees is straight down
assertEquals(Math.PI / 2.0, PointR.getAngleInRadians(p2, p4, true),
0.001);
PointR p5 = p4;
// Identical points
assertEquals(0.0, PointR.getAngleInRadians(p4, p5, true), 0.001);
}