protected ArrayList<Object[]> getNearbyRegions(double[][] array, int x, int y, int d) {
		ArrayList<Object[]> a = new ArrayList<Object[]>();
		for (int k = x - d; k < x + d; k++)
			for (int j = y - d; j < y + d; j++)
				if (k >= 0 && k < array.length && j >= 0 && j < array[k].length)
					if (distance(x, y, k, j) < d)
						a.add(new Object[] { k, j, array[k][j] });
		return a;
	}