public static void addPoint(Polygon poly, float x, float y, int index) {
    float verts[] = poly.getVertices();

    x -= poly.getX();
    y -= poly.getY();

    int length = verts.length;
    float destination[] = new float[length + 2];

    System.arraycopy(verts, 0, destination, 0, index);
    destination[index] = x;
    destination[index + 1] = y;
    System.arraycopy(verts, index, destination, index + 2, length - index);

    poly.setVertices(destination);
  }