BoundedAttitudeProvider.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.attitudes;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.geometry.euclidean.threed.FieldRotation;
  20. import org.hipparchus.geometry.euclidean.threed.Rotation;
  21. import org.orekit.frames.Frame;
  22. import org.orekit.time.AbsoluteDate;
  23. import org.orekit.time.FieldAbsoluteDate;
  24. import org.orekit.time.TimeInterval;
  25. import org.orekit.utils.FieldPVCoordinatesProvider;
  26. import org.orekit.utils.PVCoordinatesProvider;

  27. /** This interface is intended for attitude ephemerides valid only during a time range.
  28. *
  29. * <p>This interface provides a mean to retrieve an attitude at
  30. * any time within a given range. It should be implemented by attitude readers
  31. * based on external data files.</p>
  32. *
  33. * @author Bryan Cazabonne
  34. * @since 10.3
  35. */
  36. public interface BoundedAttitudeProvider extends AttitudeProvider {

  37.     /** Get the first date of the range.
  38.      * @return the first date of the range
  39.      */
  40.     AbsoluteDate getMinDate();

  41.     /** Get the last date of the range.
  42.      * @return the last date of the range
  43.      */
  44.     AbsoluteDate getMaxDate();

  45.     /**
  46.      * Creates a bounded provider given a time interval and a standard attitude provider, with the same outputs.
  47.      * @param attitudeProvider provider to be bounded
  48.      * @param interval time interval
  49.      * @return an instance of the interface
  50.      * @since 13.1
  51.      */
  52.     static BoundedAttitudeProvider of(final AttitudeProvider attitudeProvider, final TimeInterval interval) {
  53.         return new BoundedAttitudeProvider() {
  54.             @Override
  55.             public AbsoluteDate getMinDate() {
  56.                 return interval.getStartDate();
  57.             }

  58.             @Override
  59.             public AbsoluteDate getMaxDate() {
  60.                 return interval.getEndDate();
  61.             }

  62.             @Override
  63.             public Attitude getAttitude(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) {
  64.                 return attitudeProvider.getAttitude(pvProv, date, frame);
  65.             }

  66.             @Override
  67.             public Rotation getAttitudeRotation(final PVCoordinatesProvider pvProv, final AbsoluteDate date, final Frame frame) {
  68.                 return attitudeProvider.getAttitudeRotation(pvProv, date, frame);
  69.             }

  70.             @Override
  71.             public <T extends CalculusFieldElement<T>> FieldAttitude<T> getAttitude(final FieldPVCoordinatesProvider<T> pvProv, final FieldAbsoluteDate<T> date, final Frame frame) {
  72.                 return attitudeProvider.getAttitude(pvProv, date, frame);
  73.             }

  74.             @Override
  75.             public <T extends CalculusFieldElement<T>> FieldRotation<T> getAttitudeRotation(final FieldPVCoordinatesProvider<T> pvProv, final FieldAbsoluteDate<T> date, final Frame frame) {
  76.                 return attitudeProvider.getAttitudeRotation(pvProv, date, frame);
  77.             }
  78.         };
  79.     }
  80. }