int maxX = -999;
int minY = 999;
int maxY = -999;
for (int i = 0; i < vertices.size(); i++) {
WorldPos vertex = (WorldPos)vertices.get(i);
minX = Math.min(vertex.getX(), minX);
minY = Math.min(vertex.getY(), minY);
maxX = Math.max(vertex.getX(), maxX);
maxY = Math.max(vertex.getY(), maxY);
}
if (minX != 999 && maxX != -999 && minY != 999 && maxY != -999) {
NW = new WorldPos(minX, minY);
SE = new WorldPos(maxX, maxY);
setPosition(NW);
}
}