public HeightMap clone() { HeightMap heightMap = new HeightMap(width, height); for (int x = 0; x < width; x++) for (int y = 0; y < height; y++) heightMap.setHeight(x, y, map[x, y]); return heightMap; }