private static double generalRefraction(double H, double T, double P,
			int flag) {
		final double R = Math.PI / 180.0;

		double a, f, ref0, ref;

		f = 0.28 * P / (T + 273.0);

		a = H / R;

		switch (flag) {
		case APPARENT:
			ref0 = 1.0 / Math.tan((a + 7.31 / (a + 4.4)) * R);
			break;

		case GEOMETRIC:
			ref0 = 1.02 / Math.tan((a + 10.3 / (a + 5.11)) * R);
			break;

		default:
			ref0 = 0.0;
			break;
		}

		ref = ref0 * f;

		ref = ref * R / 60.0;

		return ref;
	}