/** * @param convexHull * @return */ private GeometricPoint[] getClosedPolygonFromHull(ConvexHull convexHull) { Iterable<GeometricPoint> hull = convexHull.getHull(); // get the size of the hull: number of vertices of polygon int n = convexHull.getHullSize(); // we take n + 1 GeometricPoint[] geometricPoints = new GeometricPoint[n + 1]; int j = 0; for (GeometricPoint geometricPoint : hull) { geometricPoints[j++] = geometricPoint; } // close the polygon: last point of polygon has to be equal to first point geometricPoints[n] = geometricPoints[0]; return geometricPoints; }