List of usage examples for com.badlogic.gdx.math ConvexHull computePolygon
public FloatArray computePolygon(float[] polygon, boolean sorted)
From source file:com.github.skittishSloth.openSkies.maps.generation.voronoi.Cell.java
public Polygon calculateConvexHull() { final float[] coords = new float[tiles.size() * 2]; int idx = 0;/*from ww w .j a v a2s.co m*/ for (final VoronoiTile tile : tiles) { if ((tile.getX() == 0) && (tile.getY() == 0)) { containsCorner = true; } coords[idx++] = tile.getX(); coords[idx++] = tile.getY(); } if (containsCorner == null) { containsCorner = false; } final ConvexHull ch = new ConvexHull(); final FloatArray vertices = ch.computePolygon(coords, false); final Polygon polygon = new Polygon(vertices.items); return polygon; }