private static BufferedImage initRotatedImage(BufferedImage givenImage,
			int rotationCenterX, int rotationCenterY, double rotatingAngle) {
		double maxR = -99999;
		// double minR = 99999;
		final int maxX = givenImage.getWidth() - 1;
		final int maxY = givenImage.getHeight() - 1;
		final int minX = 0;
		final int minY = 0;

		double temp = getR(minX, rotationCenterX, minY, rotationCenterY);
		if (temp > maxR) {
			maxR = temp;
		}
		temp = getR(minX, rotationCenterX, maxY, rotationCenterY);
		if (temp > maxR) {
			maxR = temp;
		}
		temp = getR(maxX, rotationCenterX, maxY, rotationCenterY);
		if (temp > maxR) {
			maxR = temp;
		}
		temp = getR(maxX, rotationCenterX, minY, rotationCenterY);
		if (temp > maxR) {
			maxR = temp;
		}

		final int L = (int) Math.round(3 * maxR + 1);
		return new BufferedImage(L, L, givenImage.getType());
	}