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
19 import org.hipparchus.CalculusFieldElement;
20 import org.orekit.errors.OrekitException;
21 import org.orekit.errors.OrekitMessages;
22 import org.orekit.time.AbsoluteDate;
23 import org.orekit.time.FieldAbsoluteDate;
24 import org.orekit.utils.PVCoordinatesProvider;
25
26 /** Class for frames moving with an orbiting satellite.
27 *
28 * <p>There are several local orbital frames available. They are specified
29 * by the {@link LOFType} enumerate.</p>
30 *
31 * <p> Do not use the {@link #getTransformTo(Frame, FieldAbsoluteDate)} method as it is
32 * not implemented.
33 *
34 * @author Luc Maisonobe
35 * @see org.orekit.propagation.SpacecraftState#toTransform()
36 */
37 public class LocalOrbitalFrame extends Frame {
38
39 /** Build a new instance.
40 *
41 * <p> It is highly recommended that {@code provider} use an analytic formulation and
42 * not numerical integration as large integration errors may result from many short
43 * propagations.
44 *
45 * @param parent parent frame (must be non-null)
46 * @param lof local orbital frame
47 * @param provider provider used to compute frame motion.
48 * @param name name of the frame
49 * @exception IllegalArgumentException if the parent frame is null
50 */
51 public LocalOrbitalFrame(final Frame parent, final LOF lof,
52 final PVCoordinatesProvider provider,
53 final String name)
54 throws IllegalArgumentException {
55 super(parent, new LocalProvider(lof, provider, parent), name, false);
56 }
57
58 /** Local provider for transforms. */
59 private static class LocalProvider implements TransformProvider {
60
61 /** Local orbital frame. */
62 private final LOF lof;
63
64 /** Provider used to compute frame motion. */
65 private final PVCoordinatesProvider provider;
66
67 /** Reference frame. */
68 private final Frame reference;
69
70 /** Simple constructor.
71 * @param lof local orbital frame
72 * @param provider provider used to compute frame motion
73 * @param reference reference frame
74 */
75 LocalProvider(final LOF lof, final PVCoordinatesProvider provider,
76 final Frame reference) {
77 this.lof = lof;
78 this.provider = provider;
79 this.reference = reference;
80 }
81
82 /** {@inheritDoc} */
83 public Transform getTransform(final AbsoluteDate date) {
84 return lof.transformFromInertial(date, provider.getPVCoordinates(date, reference));
85 }
86
87 /**
88 * This method is not implemented.
89 *
90 * <p> {@inheritDoc}
91 *
92 * @throws UnsupportedOperationException always.
93 */
94 public <T extends CalculusFieldElement<T>> FieldTransform<T> getTransform(
95 final FieldAbsoluteDate<T> date) throws UnsupportedOperationException {
96 throw new UnsupportedOperationException(
97 new OrekitException(OrekitMessages.INTERNAL_ERROR, "https://forum.orekit.org"));
98 }
99
100 }
101
102 }