List of usage examples for com.badlogic.gdx.math ConvexHull ConvexHull
ConvexHull
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;/* w w w . j ava 2s . c o 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; }