LocalOrbitalFrame.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.frames;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.orekit.errors.OrekitException;
  20. import org.orekit.errors.OrekitMessages;
  21. import org.orekit.time.AbsoluteDate;
  22. import org.orekit.time.FieldAbsoluteDate;
  23. import org.orekit.utils.PVCoordinatesProvider;

  24. /** Class for frames moving with an orbiting satellite.
  25.  *
  26.  * <p>There are several local orbital frames available. They are specified
  27.  * by the {@link LOFType} enumerate.</p>
  28.  *
  29.  * <p> Do not use the {@link #getTransformTo(Frame, FieldAbsoluteDate)} method as it is
  30.  * not implemented.
  31.  *
  32.  * @author Luc Maisonobe
  33.  * @see org.orekit.propagation.SpacecraftState#toTransform()
  34.  */
  35. public class LocalOrbitalFrame extends Frame {

  36.     /** Build a new instance.
  37.      *
  38.      * <p> It is highly recommended that {@code provider} use an analytic formulation and
  39.      * not numerical integration as large integration errors may result from many short
  40.      * propagations.
  41.      *
  42.      * @param parent parent frame (must be non-null)
  43.      * @param lof local orbital frame
  44.      * @param provider provider used to compute frame motion.
  45.      * @param name name of the frame
  46.      * @exception IllegalArgumentException if the parent frame is null
  47.      */
  48.     public LocalOrbitalFrame(final Frame parent, final LOF lof,
  49.                              final PVCoordinatesProvider provider,
  50.                              final String name)
  51.         throws IllegalArgumentException {
  52.         super(parent, new LocalProvider(lof, provider, parent), name, false);
  53.     }

  54.     /** Local provider for transforms. */
  55.     private static class LocalProvider implements TransformProvider {

  56.         /** Local orbital frame. */
  57.         private final LOF lof;

  58.         /** Provider used to compute frame motion. */
  59.         private final PVCoordinatesProvider provider;

  60.         /** Reference frame. */
  61.         private final Frame reference;

  62.         /** Simple constructor.
  63.          * @param lof local orbital frame
  64.          * @param provider provider used to compute frame motion
  65.          * @param reference reference frame
  66.          */
  67.         LocalProvider(final LOF lof, final PVCoordinatesProvider provider,
  68.                       final Frame reference) {
  69.             this.lof       = lof;
  70.             this.provider  = provider;
  71.             this.reference = reference;
  72.         }

  73.         /** {@inheritDoc} */
  74.         public Transform getTransform(final AbsoluteDate date) {
  75.             return lof.transformFromInertial(date, provider.getPVCoordinates(date, reference));
  76.         }

  77.         /**
  78.          * This method is not implemented.
  79.          *
  80.          * <p> {@inheritDoc}
  81.          *
  82.          * @throws UnsupportedOperationException always.
  83.          */
  84.         public <T extends CalculusFieldElement<T>> FieldTransform<T> getTransform(
  85.                 final FieldAbsoluteDate<T> date) throws UnsupportedOperationException {
  86.             throw new UnsupportedOperationException(
  87.                     new OrekitException(OrekitMessages.INTERNAL_ERROR, "https://forum.orekit.org"));
  88.         }

  89.     }

  90. }