assertTrue(circle.contains(new Node2D(90.0, 60.0)));
assertFalse(circle.contains(new Node2D(-1000.0, -900.0)));
}
public void test3PointConstructor() {
Point2D pt1 = new Node2D(0.0, 0.0);
Point2D pt2 = new Node2D(5.0, 0.0);
Point2D pt3 = new Node2D(2.5, -2.0);
Circle2D circle = new Circle2D(pt1, pt2, pt3);
assertNotNull(circle);
assertEquals("Circle2D: X:2.5 Y:0.5625 r:2.5625", circle.toString());
assertEquals(5.125, circle.getRectangle().getWidth());
assertEquals(5.125, circle.getRectangle().getHeight());
assertEquals(2.5, circle.getCenter().getX());
//3 vertical points (bad!)
pt1 = new Node2D(0.0, 5.0);
pt2 = new Node2D(0.0, 10.0);
pt3 = new Node2D(0.0, 15.0);
try {
circle = new Circle2D(pt1, pt2, pt3);
fail("should have thrown illegal argument exception");
} catch (IllegalArgumentException e) {
}
pt1 = new Node2D(0.0, 5.0);
pt2 = new Node2D(0.0, 10.0);
pt3 = new Node2D(1.0, 15.0);
circle = new Circle2D(pt1, pt2, pt3);
assertNotNull(circle);
assertEquals("Circle2D: X:25.5 Y:7.5 r:25.622255950637914", circle.toString());
}