calcQi static method
Implementation
static double calcQi(double jd) {
int size = QI_KB.length;
double d = 0;
int pc = 7, i;
jd += Solar.J2000;
double f1 = QI_KB[0] - pc, f2 = QI_KB[size - 1] - pc, f3 = 2436935;
if (jd < f1 || jd >= f3) {
d = (qiHigh(((jd + pc - 2451259) / 365.2422 * 24).floorToDouble() * math.pi / 12) +
0.5)
.floorToDouble();
} else if (jd >= f1 && jd < f2) {
for (i = 0; i < size; i += 2) {
if (jd + pc < QI_KB[i + 2]) {
break;
}
}
d = QI_KB[i] +
QI_KB[i + 1] *
((jd + pc - QI_KB[i]) / QI_KB[i + 1]).floorToDouble();
d = (d + 0.5).floorToDouble();
if (d == 1683460) {
d++;
}
d -= Solar.J2000;
} else if (jd >= f2 && jd < f3) {
d = (qiLow(((jd + pc - 2451259) / 365.2422 * 24).floorToDouble() * math.pi / 12) + 0.5).floorToDouble();
int from = ((jd - f2) / 365.2422 * 24).floor();
String n = _qb.substring(from, from + 1);
if ('1' == n) {
d += 1;
} else if ('2' == n) {
d -= 1;
}
}
return d;
}