@Test
public void testPointsOf() throws Exception {

    Rectangle2D rect = new Rectangle2D.Double(-5, -5, 10, 10);
    List<Point2D> points = ConvexHull.pointsOf(rect);
    assertThat(points.size(), is(4));
    assertThat(points.get(0).getX(), closeTo(-5, 0.01));
    assertThat(points.get(0).getY(), closeTo(-5, 0.01));
    assertThat(points.get(1).getX(), closeTo(5, 0.01));
    assertThat(points.get(1).getY(), closeTo(-5, 0.01));
    assertThat(points.get(2).getX(), closeTo(5, 0.01));
    assertThat(points.get(2).getY(), closeTo(5, 0.01));
    assertThat(points.get(3).getX(), closeTo(-5, 0.01));
    assertThat(points.get(3).getY(), closeTo(5, 0.01));
}