mLon static method

double mLon(
  1. double t,
  2. int n
)

Implementation

static double mLon(double t, int n) {
  List<List<double>> ob = XL1;
  int obl = ob[0].length;
  double tn = 1;
  double v = 0;
  int j;
  double c = 0;
  double t2 = t * t, t3 = t2 * t, t4 = t3 * t, t5 = t4 * t, tx = t - 10;
  v += (3.81034409 +
          8399.684730072 * t -
          3.319e-05 * t2 +
          3.11e-08 * t3 -
          2.033e-10 * t4) *
      SECOND_PER_RAD;
  v += 5028.792262 * t +
      1.1124406 * t2 +
      0.00007699 * t3 -
      0.000023479 * t4 -
      0.0000000178 * t5;
  if (tx > 0) {
    v += -0.866 + 1.43 * tx + 0.054 * tx * tx;
  }
  t2 /= 1e4;
  t3 /= 1e8;
  t4 /= 1e8;

  n *= 6;
  if (n < 0) {
    n = obl;
  }
  for (int i = 0, x = ob.length; i < x; i++, tn *= t) {
    List<double> f = ob[i];
    int l = f.length;
    int m = (n * l / obl + 0.5).floor();
    if (i > 0) {
      m += 6;
    }
    if (m >= l) {
      m = l;
    }
    c = 0;
    for (j = 0; j < m; j += 6) {
      c += f[j] *
          math.cos(f[j + 1] +
              t * f[j + 2] +
              t2 * f[j + 3] +
              t3 * f[j + 4] +
              t4 * f[j + 5]);
    }
    v += c * tn;
  }
  v /= SECOND_PER_RAD;
  return v;
}