Ephemeris* PlatformPosition::Interpolate(JSDDateTime date) const { const double JOURCIVIL_LENGTH = 86400.0; Ephemeris* ephem = NULL; if (_nbrData <= 1) { return NULL; } /* * The first element of the list is cloned to ensure that the * output ephemeris is expressed in the same coordinate system as * input ones */ ephem = _data[0]->Clone(); /* NORMAL CASE */ /*------------*/ double dt = 0.0; if (ephem != NULL) { ephem->set_date(date); dt = (date.get_day0hTU().get_julianDate() - _data[0]->get_date().get_day0hTU().get_julianDate()) * JOURCIVIL_LENGTH + date.get_second() - _data[0]->get_date().get_second() + date.get_decimal() - _data[0]->get_date().get_decimal(); /* Computation by Everett */ /*---------------------*/ double pos[3]; double speed[3]; for (int j = 0; j < 3; j++) { _interpolator[j]->Interpolate(dt, pos[j], speed[j]); } ephem->set_position(pos); ephem->set_speed(speed); } return ephem; }