TimeStampedFieldAngularCoordinates.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.utils;

  18. import java.util.Collection;

  19. import org.hipparchus.Field;
  20. import org.hipparchus.RealFieldElement;
  21. import org.hipparchus.analysis.differentiation.DerivativeStructure;
  22. import org.hipparchus.analysis.differentiation.FieldDerivativeStructure;
  23. import org.hipparchus.analysis.interpolation.FieldHermiteInterpolator;
  24. import org.hipparchus.geometry.euclidean.threed.FieldRotation;
  25. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  26. import org.hipparchus.geometry.euclidean.threed.RotationConvention;
  27. import org.hipparchus.util.FastMath;
  28. import org.orekit.errors.OrekitException;
  29. import org.orekit.errors.OrekitInternalError;
  30. import org.orekit.errors.OrekitMessages;
  31. import org.orekit.time.AbsoluteDate;
  32. import org.orekit.time.FieldAbsoluteDate;
  33. import org.orekit.time.TimeStamped;

  34. /** {@link TimeStamped time-stamped} version of {@link FieldAngularCoordinates}.
  35.  * <p>Instances of this class are guaranteed to be immutable.</p>
  36.  * @param <T> the type of the field elements
  37.  * @author Luc Maisonobe
  38.  * @since 7.0
  39.  */
  40. public class TimeStampedFieldAngularCoordinates<T extends RealFieldElement<T>>
  41.     extends FieldAngularCoordinates<T> {

  42.     /** The date. */
  43.     private final FieldAbsoluteDate<T> date;

  44.     /** Build the rotation that transforms a pair of pv coordinates into another pair.

  45.      * <p><em>WARNING</em>! This method requires much more stringent assumptions on
  46.      * its parameters than the similar {@link org.hipparchus.geometry.euclidean.threed.Rotation#Rotation(
  47.      * org.hipparchus.geometry.euclidean.threed.Vector3D, org.hipparchus.geometry.euclidean.threed.Vector3D,
  48.      * org.hipparchus.geometry.euclidean.threed.Vector3D, org.hipparchus.geometry.euclidean.threed.Vector3D)
  49.      * constructor} from the {@link org.hipparchus.geometry.euclidean.threed.Rotation Rotation} class.
  50.      * As far as the Rotation constructor is concerned, the {@code v₂} vector from
  51.      * the second pair can be slightly misaligned. The Rotation constructor will
  52.      * compensate for this misalignment and create a rotation that ensure {@code
  53.      * v₁ = r(u₁)} and {@code v₂ ∈ plane (r(u₁), r(u₂))}. <em>THIS IS NOT
  54.      * TRUE ANYMORE IN THIS CLASS</em>! As derivatives are involved and must be
  55.      * preserved, this constructor works <em>only</em> if the two pairs are fully
  56.      * consistent, i.e. if a rotation exists that fulfill all the requirements: {@code
  57.      * v₁ = r(u₁)}, {@code v₂ = r(u₂)}, {@code dv₁/dt = dr(u₁)/dt}, {@code dv₂/dt
  58.      * = dr(u₂)/dt}, {@code d²v₁/dt² = d²r(u₁)/dt²}, {@code d²v₂/dt² = d²r(u₂)/dt²}.</p>

  59.      * @param date coordinates date
  60.      * @param u1 first vector of the origin pair
  61.      * @param u2 second vector of the origin pair
  62.      * @param v1 desired image of u1 by the rotation
  63.      * @param v2 desired image of u2 by the rotation
  64.      * @param tolerance relative tolerance factor used to check singularities
  65.      * @exception OrekitException if the vectors components cannot be converted to
  66.      * {@link DerivativeStructure} with proper order
  67.      */
  68.     public TimeStampedFieldAngularCoordinates (final AbsoluteDate date,
  69.                                                final FieldPVCoordinates<T> u1, final FieldPVCoordinates<T> u2,
  70.                                                final FieldPVCoordinates<T> v1, final FieldPVCoordinates<T> v2,
  71.                                                final double tolerance)
  72.         throws OrekitException {
  73.         this(new FieldAbsoluteDate<>(u1.getPosition().getX().getField(), date),
  74.              u1, u2, v1, v2, tolerance);
  75.     }

  76.     /** Build the rotation that transforms a pair of pv coordinates into another pair.

  77.      * <p><em>WARNING</em>! This method requires much more stringent assumptions on
  78.      * its parameters than the similar {@link org.hipparchus.geometry.euclidean.threed.Rotation#Rotation(
  79.      * org.hipparchus.geometry.euclidean.threed.Vector3D, org.hipparchus.geometry.euclidean.threed.Vector3D,
  80.      * org.hipparchus.geometry.euclidean.threed.Vector3D, org.hipparchus.geometry.euclidean.threed.Vector3D)
  81.      * constructor} from the {@link org.hipparchus.geometry.euclidean.threed.Rotation Rotation} class.
  82.      * As far as the Rotation constructor is concerned, the {@code v₂} vector from
  83.      * the second pair can be slightly misaligned. The Rotation constructor will
  84.      * compensate for this misalignment and create a rotation that ensure {@code
  85.      * v₁ = r(u₁)} and {@code v₂ ∈ plane (r(u₁), r(u₂))}. <em>THIS IS NOT
  86.      * TRUE ANYMORE IN THIS CLASS</em>! As derivatives are involved and must be
  87.      * preserved, this constructor works <em>only</em> if the two pairs are fully
  88.      * consistent, i.e. if a rotation exists that fulfill all the requirements: {@code
  89.      * v₁ = r(u₁)}, {@code v₂ = r(u₂)}, {@code dv₁/dt = dr(u₁)/dt}, {@code dv₂/dt
  90.      * = dr(u₂)/dt}, {@code d²v₁/dt² = d²r(u₁)/dt²}, {@code d²v₂/dt² = d²r(u₂)/dt²}.</p>

  91.      * @param date coordinates date
  92.      * @param u1 first vector of the origin pair
  93.      * @param u2 second vector of the origin pair
  94.      * @param v1 desired image of u1 by the rotation
  95.      * @param v2 desired image of u2 by the rotation
  96.      * @param tolerance relative tolerance factor used to check singularities
  97.      * @exception OrekitException if the vectors components cannot be converted to
  98.      * {@link DerivativeStructure} with proper order
  99.      */
  100.     public TimeStampedFieldAngularCoordinates (final FieldAbsoluteDate<T> date,
  101.                                                final FieldPVCoordinates<T> u1, final FieldPVCoordinates<T> u2,
  102.                                                final FieldPVCoordinates<T> v1, final FieldPVCoordinates<T> v2,
  103.                                                final double tolerance)
  104.         throws OrekitException {
  105.         super(u1, u2, v1, v2, tolerance);
  106.         this.date = date;
  107.     }

  108.     /** Builds a rotation/rotation rate pair.
  109.      * @param date coordinates date
  110.      * @param rotation rotation
  111.      * @param rotationRate rotation rate Ω (rad/s)
  112.      * @param rotationAcceleration rotation acceleration dΩ/dt (rad²/s²)
  113.      */
  114.     public TimeStampedFieldAngularCoordinates(final AbsoluteDate date,
  115.                                               final FieldRotation<T> rotation,
  116.                                               final FieldVector3D<T> rotationRate,
  117.                                               final FieldVector3D<T> rotationAcceleration) {
  118.         this(new FieldAbsoluteDate<>(rotation.getQ0().getField(), date),
  119.              rotation, rotationRate, rotationAcceleration);
  120.     }

  121.     /** Builds a rotation/rotation rate pair.
  122.      * @param date coordinates date
  123.      * @param rotation rotation
  124.      * @param rotationRate rotation rate Ω (rad/s)
  125.      * @param rotationAcceleration rotation acceleration dΩ/dt (rad²/s²)
  126.      */
  127.     public TimeStampedFieldAngularCoordinates(final FieldAbsoluteDate<T> date,
  128.                                               final FieldRotation<T> rotation,
  129.                                               final FieldVector3D<T> rotationRate,
  130.                                               final FieldVector3D<T> rotationAcceleration) {
  131.         super(rotation, rotationRate, rotationAcceleration);
  132.         this.date = date;
  133.     }

  134.     /** Builds an instance for a regular {@link TimeStampedAngularCoordinates}.
  135.      * @param field fields to which the elements belong
  136.      * @param ac coordinates to convert
  137.      * @since 9.0
  138.      */
  139.     public TimeStampedFieldAngularCoordinates(final Field<T> field,
  140.                                               final TimeStampedAngularCoordinates ac) {
  141.         this(new FieldAbsoluteDate<>(field, ac.getDate()),
  142.              new FieldRotation<>(field, ac.getRotation()),
  143.              new FieldVector3D<>(field, ac.getRotationRate()),
  144.              new FieldVector3D<>(field, ac.getRotationAcceleration()));
  145.     }

  146.     /** Builds a TimeStampedFieldAngularCoordinates from  a {@link FieldRotation}&lt;{@link FieldDerivativeStructure}&gt;.
  147.      * <p>
  148.      * The rotation components must have time as their only derivation parameter and
  149.      * have consistent derivation orders.
  150.      * </p>
  151.      * @param date coordinates date
  152.      * @param r rotation with time-derivatives embedded within the coordinates
  153.      * @since 9.2
  154.      */
  155.     public TimeStampedFieldAngularCoordinates(final FieldAbsoluteDate<T> date,
  156.                                               final FieldRotation<FieldDerivativeStructure<T>> r) {
  157.         super(r);
  158.         this.date = date;
  159.     }

  160.     /** Revert a rotation/rotation rate pair.
  161.      * Build a pair which reverse the effect of another pair.
  162.      * @return a new pair whose effect is the reverse of the effect
  163.      * of the instance
  164.      */
  165.     public TimeStampedFieldAngularCoordinates<T> revert() {
  166.         return new TimeStampedFieldAngularCoordinates<>(date,
  167.                                                         getRotation().revert(),
  168.                                                         getRotation().applyInverseTo(getRotationRate().negate()),
  169.                                                         getRotation().applyInverseTo(getRotationAcceleration().negate()));
  170.     }

  171.     /** Get the date.
  172.      * @return date
  173.      */
  174.     public FieldAbsoluteDate<T> getDate() {
  175.         return date;
  176.     }

  177.     /** Get a time-shifted state.
  178.      * <p>
  179.      * The state can be slightly shifted to close dates. This shift is based on
  180.      * a simple linear model. It is <em>not</em> intended as a replacement for
  181.      * proper attitude propagation but should be sufficient for either small
  182.      * time shifts or coarse accuracy.
  183.      * </p>
  184.      * @param dt time shift in seconds
  185.      * @return a new state, shifted with respect to the instance (which is immutable)
  186.      */
  187.     public TimeStampedFieldAngularCoordinates<T> shiftedBy(final double dt) {
  188.         return shiftedBy(getDate().getField().getZero().add(dt));
  189.     }

  190.     /** Get a time-shifted state.
  191.      * <p>
  192.      * The state can be slightly shifted to close dates. This shift is based on
  193.      * a simple linear model. It is <em>not</em> intended as a replacement for
  194.      * proper attitude propagation but should be sufficient for either small
  195.      * time shifts or coarse accuracy.
  196.      * </p>
  197.      * @param dt time shift in seconds
  198.      * @return a new state, shifted with respect to the instance (which is immutable)
  199.      */
  200.     public TimeStampedFieldAngularCoordinates<T> shiftedBy(final T dt) {
  201.         final FieldAngularCoordinates<T> sac = super.shiftedBy(dt);
  202.         return new TimeStampedFieldAngularCoordinates<>(date.shiftedBy(dt),
  203.                                                         sac.getRotation(), sac.getRotationRate(), sac.getRotationAcceleration());

  204.     }

  205.     /** Add an offset from the instance.
  206.      * <p>
  207.      * We consider here that the offset rotation is applied first and the
  208.      * instance is applied afterward. Note that angular coordinates do <em>not</em>
  209.      * commute under this operation, i.e. {@code a.addOffset(b)} and {@code
  210.      * b.addOffset(a)} lead to <em>different</em> results in most cases.
  211.      * </p>
  212.      * <p>
  213.      * The two methods {@link #addOffset(FieldAngularCoordinates) addOffset} and
  214.      * {@link #subtractOffset(FieldAngularCoordinates) subtractOffset} are designed
  215.      * so that round trip applications are possible. This means that both {@code
  216.      * ac1.subtractOffset(ac2).addOffset(ac2)} and {@code
  217.      * ac1.addOffset(ac2).subtractOffset(ac2)} return angular coordinates equal to ac1.
  218.      * </p>
  219.      * @param offset offset to subtract
  220.      * @return new instance, with offset subtracted
  221.      * @see #subtractOffset(FieldAngularCoordinates)
  222.      */
  223.     public TimeStampedFieldAngularCoordinates<T> addOffset(final FieldAngularCoordinates<T> offset) {
  224.         final FieldVector3D<T> rOmega    = getRotation().applyTo(offset.getRotationRate());
  225.         final FieldVector3D<T> rOmegaDot = getRotation().applyTo(offset.getRotationAcceleration());
  226.         return new TimeStampedFieldAngularCoordinates<>(date,
  227.                                                         getRotation().compose(offset.getRotation(), RotationConvention.VECTOR_OPERATOR),
  228.                                                         getRotationRate().add(rOmega),
  229.                                                         new FieldVector3D<>( 1.0, getRotationAcceleration(),
  230.                                                                               1.0, rOmegaDot,
  231.                                                                              -1.0, FieldVector3D.crossProduct(getRotationRate(), rOmega)));
  232.     }

  233.     /** Subtract an offset from the instance.
  234.      * <p>
  235.      * We consider here that the offset Rotation is applied first and the
  236.      * instance is applied afterward. Note that angular coordinates do <em>not</em>
  237.      * commute under this operation, i.e. {@code a.subtractOffset(b)} and {@code
  238.      * b.subtractOffset(a)} lead to <em>different</em> results in most cases.
  239.      * </p>
  240.      * <p>
  241.      * The two methods {@link #addOffset(FieldAngularCoordinates) addOffset} and
  242.      * {@link #subtractOffset(FieldAngularCoordinates) subtractOffset} are designed
  243.      * so that round trip applications are possible. This means that both {@code
  244.      * ac1.subtractOffset(ac2).addOffset(ac2)} and {@code
  245.      * ac1.addOffset(ac2).subtractOffset(ac2)} return angular coordinates equal to ac1.
  246.      * </p>
  247.      * @param offset offset to subtract
  248.      * @return new instance, with offset subtracted
  249.      * @see #addOffset(FieldAngularCoordinates)
  250.      */
  251.     public TimeStampedFieldAngularCoordinates<T> subtractOffset(final FieldAngularCoordinates<T> offset) {
  252.         return addOffset(offset.revert());
  253.     }

  254.     /** Interpolate angular coordinates.
  255.      * <p>
  256.      * The interpolated instance is created by polynomial Hermite interpolation
  257.      * on Rodrigues vector ensuring rotation rate remains the exact derivative of rotation.
  258.      * </p>
  259.      * <p>
  260.      * This method is based on Sergei Tanygin's paper <a
  261.      * href="http://www.agi.com/downloads/resources/white-papers/Attitude-interpolation.pdf">Attitude
  262.      * Interpolation</a>, changing the norm of the vector to match the modified Rodrigues
  263.      * vector as described in Malcolm D. Shuster's paper <a
  264.      * href="http://www.ladispe.polito.it/corsi/Meccatronica/02JHCOR/2011-12/Slides/Shuster_Pub_1993h_J_Repsurv_scan.pdf">A
  265.      * Survey of Attitude Representations</a>. This change avoids the singularity at π.
  266.      * There is still a singularity at 2π, which is handled by slightly offsetting all rotations
  267.      * when this singularity is detected.
  268.      * </p>
  269.      * <p>
  270.      * Note that even if first time derivatives (rotation rates)
  271.      * from sample can be ignored, the interpolated instance always includes
  272.      * interpolated derivatives. This feature can be used explicitly to
  273.      * compute these derivatives when it would be too complex to compute them
  274.      * from an analytical formula: just compute a few sample points from the
  275.      * explicit formula and set the derivatives to zero in these sample points,
  276.      * then use interpolation to add derivatives consistent with the rotations.
  277.      * </p>
  278.      * @param date interpolation date
  279.      * @param filter filter for derivatives from the sample to use in interpolation
  280.      * @param sample sample points on which interpolation should be done
  281.      * @param <T> the type of the field elements
  282.      * @return a new position-velocity, interpolated at specified date
  283.      * @exception OrekitException if the number of point is too small for interpolating
  284.      */
  285.     public static <T extends RealFieldElement<T>>
  286.         TimeStampedFieldAngularCoordinates<T> interpolate(final AbsoluteDate date,
  287.                                                           final AngularDerivativesFilter filter,
  288.                                                           final Collection<TimeStampedFieldAngularCoordinates<T>> sample)
  289.         throws OrekitException {
  290.         return interpolate(new FieldAbsoluteDate<>(sample.iterator().next().getRotation().getQ0().getField(), date),
  291.                            filter, sample);
  292.     }

  293.     /** Interpolate angular coordinates.
  294.      * <p>
  295.      * The interpolated instance is created by polynomial Hermite interpolation
  296.      * on Rodrigues vector ensuring rotation rate remains the exact derivative of rotation.
  297.      * </p>
  298.      * <p>
  299.      * This method is based on Sergei Tanygin's paper <a
  300.      * href="http://www.agi.com/downloads/resources/white-papers/Attitude-interpolation.pdf">Attitude
  301.      * Interpolation</a>, changing the norm of the vector to match the modified Rodrigues
  302.      * vector as described in Malcolm D. Shuster's paper <a
  303.      * href="http://www.ladispe.polito.it/corsi/Meccatronica/02JHCOR/2011-12/Slides/Shuster_Pub_1993h_J_Repsurv_scan.pdf">A
  304.      * Survey of Attitude Representations</a>. This change avoids the singularity at π.
  305.      * There is still a singularity at 2π, which is handled by slightly offsetting all rotations
  306.      * when this singularity is detected.
  307.      * </p>
  308.      * <p>
  309.      * Note that even if first time derivatives (rotation rates)
  310.      * from sample can be ignored, the interpolated instance always includes
  311.      * interpolated derivatives. This feature can be used explicitly to
  312.      * compute these derivatives when it would be too complex to compute them
  313.      * from an analytical formula: just compute a few sample points from the
  314.      * explicit formula and set the derivatives to zero in these sample points,
  315.      * then use interpolation to add derivatives consistent with the rotations.
  316.      * </p>
  317.      * @param date interpolation date
  318.      * @param filter filter for derivatives from the sample to use in interpolation
  319.      * @param sample sample points on which interpolation should be done
  320.      * @param <T> the type of the field elements
  321.      * @return a new position-velocity, interpolated at specified date
  322.      * @exception OrekitException if the number of point is too small for interpolating
  323.      */
  324.     public static <T extends RealFieldElement<T>>
  325.         TimeStampedFieldAngularCoordinates<T> interpolate(final FieldAbsoluteDate<T> date,
  326.                                                           final AngularDerivativesFilter filter,
  327.                                                           final Collection<TimeStampedFieldAngularCoordinates<T>> sample)
  328.         throws OrekitException {

  329.         // get field properties
  330.         final Field<T> field = sample.iterator().next().getRotation().getQ0().getField();

  331.         // set up safety elements for 2π singularity avoidance
  332.         final double epsilon   = 2 * FastMath.PI / sample.size();
  333.         final double threshold = FastMath.min(-(1.0 - 1.0e-4), -FastMath.cos(epsilon / 4));

  334.         // set up a linear model canceling mean rotation rate
  335.         final FieldVector3D<T> meanRate;
  336.         if (filter != AngularDerivativesFilter.USE_R) {
  337.             FieldVector3D<T> sum = FieldVector3D.getZero(field);
  338.             for (final TimeStampedFieldAngularCoordinates<T> datedAC : sample) {
  339.                 sum = sum.add(datedAC.getRotationRate());
  340.             }
  341.             meanRate = new FieldVector3D<>(1.0 / sample.size(), sum);
  342.         } else {
  343.             if (sample.size() < 2) {
  344.                 throw new OrekitException(OrekitMessages.NOT_ENOUGH_DATA_FOR_INTERPOLATION,
  345.                                           sample.size());
  346.             }
  347.             FieldVector3D<T> sum = FieldVector3D.getZero(field);
  348.             TimeStampedFieldAngularCoordinates<T> previous = null;
  349.             for (final TimeStampedFieldAngularCoordinates<T> datedAC : sample) {
  350.                 if (previous != null) {
  351.                     sum = sum.add(estimateRate(previous.getRotation(), datedAC.getRotation(),
  352.                                                datedAC.date.durationFrom(previous.getDate())));
  353.                 }
  354.                 previous = datedAC;
  355.             }
  356.             meanRate = new FieldVector3D<>(1.0 / (sample.size() - 1), sum);
  357.         }
  358.         TimeStampedFieldAngularCoordinates<T> offset =
  359.                 new TimeStampedFieldAngularCoordinates<>(date, FieldRotation.getIdentity(field),
  360.                                                          meanRate, FieldVector3D.getZero(field));

  361.         boolean restart = true;
  362.         for (int i = 0; restart && i < sample.size() + 2; ++i) {

  363.             // offset adaptation parameters
  364.             restart = false;

  365.             // set up an interpolator taking derivatives into account
  366.             final FieldHermiteInterpolator<T> interpolator = new FieldHermiteInterpolator<>();

  367.             // add sample points
  368.             double sign = +1.0;
  369.             FieldRotation<T> previous = FieldRotation.getIdentity(field);

  370.             for (final TimeStampedFieldAngularCoordinates<T> ac : sample) {

  371.                 // remove linear offset from the current coordinates
  372.                 final T dt = ac.date.durationFrom(date);
  373.                 final TimeStampedFieldAngularCoordinates<T> fixed = ac.subtractOffset(offset.shiftedBy(dt));

  374.                 // make sure all interpolated points will be on the same branch
  375.                 final T dot = dt.linearCombination(fixed.getRotation().getQ0(), previous.getQ0(),
  376.                                                    fixed.getRotation().getQ1(), previous.getQ1(),
  377.                                                    fixed.getRotation().getQ2(), previous.getQ2(),
  378.                                                    fixed.getRotation().getQ3(), previous.getQ3());
  379.                 sign = FastMath.copySign(1.0, dot.getReal() * sign);
  380.                 previous = fixed.getRotation();

  381.                 // check modified Rodrigues vector singularity
  382.                 if (fixed.getRotation().getQ0().getReal() * sign < threshold) {
  383.                     // the sample point is close to a modified Rodrigues vector singularity
  384.                     // we need to change the linear offset model to avoid this
  385.                     restart = true;
  386.                     break;
  387.                 }

  388.                 final T[][] rodrigues = fixed.getModifiedRodrigues(sign);
  389.                 switch (filter) {
  390.                     case USE_RRA:
  391.                         // populate sample with rotation, rotation rate and acceleration data
  392.                         interpolator.addSamplePoint(dt, rodrigues[0], rodrigues[1], rodrigues[2]);
  393.                         break;
  394.                     case USE_RR:
  395.                         // populate sample with rotation and rotation rate data
  396.                         interpolator.addSamplePoint(dt, rodrigues[0], rodrigues[1]);
  397.                         break;
  398.                     case USE_R:
  399.                         // populate sample with rotation data only
  400.                         interpolator.addSamplePoint(dt, rodrigues[0]);
  401.                         break;
  402.                     default :
  403.                         // this should never happen
  404.                         throw new OrekitInternalError(null);
  405.                 }
  406.             }

  407.             if (restart) {
  408.                 // interpolation failed, some intermediate rotation was too close to 2π
  409.                 // we need to offset all rotations to avoid the singularity
  410.                 offset = offset.addOffset(new FieldAngularCoordinates<>(new FieldRotation<>(FieldVector3D.getPlusI(field),
  411.                                                                                             field.getZero().add(epsilon),
  412.                                                                                             RotationConvention.VECTOR_OPERATOR),
  413.                                                                         FieldVector3D.getZero(field),
  414.                                                                         FieldVector3D.getZero(field)));
  415.             } else {
  416.                 // interpolation succeeded with the current offset
  417.                 final T[][] p = interpolator.derivatives(field.getZero(), 2);
  418.                 final FieldAngularCoordinates<T> ac = createFromModifiedRodrigues(p);
  419.                 return new TimeStampedFieldAngularCoordinates<>(offset.getDate(),
  420.                                                                 ac.getRotation(),
  421.                                                                 ac.getRotationRate(),
  422.                                                                 ac.getRotationAcceleration()).addOffset(offset);
  423.             }

  424.         }

  425.         // this should never happen
  426.         throw new OrekitInternalError(null);

  427.     }

  428. }