TimeInterpolable.java

  1. /* Copyright 2002-2018 CS Systèmes d'Information
  2.  * Licensed to CS Systèmes d'Information (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.time;

  18. import java.util.Collection;
  19. import java.util.stream.Stream;

  20. import org.orekit.errors.OrekitException;

  21. /** This interface represents objects that can be interpolated in time.
  22.  * @param <T> Type of the object.
  23.  * @author Luc Maisonobe
  24.  */
  25. public interface TimeInterpolable<T extends TimeInterpolable<T>> {

  26.     /** Get an interpolated instance.
  27.      * <p>
  28.      * Note that the state of the current instance may not be used
  29.      * in the interpolation process, only its type and non interpolable
  30.      * fields are used (for example central attraction coefficient or
  31.      * frame when interpolating orbits). The interpolable fields taken
  32.      * into account are taken only from the states of the sample points.
  33.      * So if the state of the instance must be used, the instance should
  34.      * be included in the sample points.
  35.      * </p>
  36.      * <p>
  37.      * Note that this method is designed for small samples only (say up
  38.      * to about 10-20 points) so it can be implemented using polynomial
  39.      * interpolation (typically Hermite interpolation). Using too much
  40.      * points may induce <a
  41.      * href="http://en.wikipedia.org/wiki/Runge%27s_phenomenon">Runge's
  42.      * phenomenon</a> and numerical problems (including NaN appearing).
  43.      * </p>
  44.      * @param date interpolation date
  45.      * @param sample sample points on which interpolation should be done
  46.      * @return a new instance, interpolated at specified date
  47.      * @exception OrekitException if interpolation cannot be performed
  48.      */
  49.     default T interpolate(AbsoluteDate date, Collection<T> sample)
  50.         throws OrekitException {
  51.         return interpolate(date, sample.stream());
  52.     }

  53.     /** Get an interpolated instance.
  54.      * <p>
  55.      * Note that the state of the current instance may not be used
  56.      * in the interpolation process, only its type and non interpolable
  57.      * fields are used (for example central attraction coefficient or
  58.      * frame when interpolating orbits). The interpolable fields taken
  59.      * into account are taken only from the states of the sample points.
  60.      * So if the state of the instance must be used, the instance should
  61.      * be included in the sample points.
  62.      * </p>
  63.      * <p>
  64.      * Note that this method is designed for small samples only (say up
  65.      * to about 10-20 points) so it can be implemented using polynomial
  66.      * interpolation (typically Hermite interpolation). Using too much
  67.      * points may induce <a
  68.      * href="http://en.wikipedia.org/wiki/Runge%27s_phenomenon">Runge's
  69.      * phenomenon</a> and numerical problems (including NaN appearing).
  70.      * </p>
  71.      * @param date interpolation date
  72.      * @param sample sample points on which interpolation should be done
  73.      * @return a new instance, interpolated at specified date
  74.      * @exception OrekitException if interpolation cannot be performed
  75.      * @since 9.0
  76.      */
  77.     T interpolate(AbsoluteDate date, Stream<T> sample)
  78.         throws OrekitException;

  79. }