AngularDerivativesFilter.java

  1. /* Copyright 2002-2025 CS GROUP
  2.  * Licensed to CS GROUP (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 org.orekit.errors.OrekitIllegalArgumentException;
  19. import org.orekit.errors.OrekitMessages;
  20. import org.orekit.time.AbsoluteDate;
  21. import org.orekit.time.FieldAbsoluteDate;

  22. /** Enumerate for selecting which derivatives to use in {@link TimeStampedAngularCoordinates}
  23.  * and {@link TimeStampedFieldAngularCoordinates} interpolation.
  24.  * @see TimeStampedAngularCoordinatesHermiteInterpolator#interpolate(AbsoluteDate, java.util.Collection)
  25.  * @see TimeStampedFieldAngularCoordinatesHermiteInterpolator#interpolate(FieldAbsoluteDate, java.util.Collection)
  26.  * @see CartesianDerivativesFilter
  27.  * @author Luc Maisonobe
  28.  * @since 7.0
  29.  */
  30. public enum AngularDerivativesFilter {

  31.     /** Use only rotations, ignoring rotation rates. */
  32.     USE_R(0),

  33.     /** Use rotations and rotation rates. */
  34.     USE_RR(1),

  35.     /** Use rotations, rotation rates and acceleration. */
  36.     USE_RRA(2);

  37.     /** Maximum derivation order. */
  38.     private final int maxOrder;

  39.     /** Simple constructor.
  40.      * @param maxOrder maximum derivation order
  41.      */
  42.     AngularDerivativesFilter(final int maxOrder) {
  43.         this.maxOrder = maxOrder;
  44.     }

  45.     /** Get the maximum derivation order.
  46.      * @return maximum derivation order
  47.      */
  48.     public int getMaxOrder() {
  49.         return maxOrder;
  50.     }

  51.     /** Get the filter corresponding to a maximum derivation order.
  52.      * @param order maximum derivation order
  53.      * @return the filter corresponding to derivation order
  54.      * @exception IllegalArgumentException if the order is out of range
  55.      */
  56.     public static AngularDerivativesFilter getFilter(final int order)
  57.         throws IllegalArgumentException {
  58.         for (final AngularDerivativesFilter filter : values()) {
  59.             if (filter.getMaxOrder() == order) {
  60.                 return filter;
  61.             }
  62.         }
  63.         throw new OrekitIllegalArgumentException(OrekitMessages.OUT_OF_RANGE_DERIVATION_ORDER, order);
  64.     }

  65. }