1   /* Copyright 2002-2026 Guo Xiaozhong
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.bodies;
18  
19  import org.hipparchus.geometry.euclidean.threed.Vector3D;
20  import org.orekit.time.AbsoluteDate;
21  
22  /** A simple container for JPL libration data.
23   * <p>
24   * As described in
25   * <a href="https://ssd.jpl.nasa.gov/ftp/eph/planets/ascii/ascii_format.txt">
26   * Internal Format of the Ephemeris Files</a> of JPL, there are three components
27   * for librations : phi, theta, psi, which can be returned by {@link getLibration},
28   * or individually by {@link getPhi}, {@link getTheta}, and {@link getPsi}.
29   * </p>
30   * @author Guo Xiaozhong
31   * @since 14.0
32   */
33  public class JPLLibration {
34  
35      /** Raw provider. */
36      private final transient JPLEphemeridesLoader.RawPVProvider rawPVProvider;
37  
38      /** Build an instance.
39       * @param rawPVProvider raw libration provider
40       */
41      JPLLibration (final JPLEphemeridesLoader.RawPVProvider rawPVProvider) {
42          this.rawPVProvider  = rawPVProvider;
43      }
44  
45      /** Get the libration.
46       * @param date current date
47       * @return libration in radians
48       */
49      public Vector3D getLibration(final AbsoluteDate date) {
50          return rawPVProvider.getRawPosition(date);
51      }
52  
53      /** Get the phi component of libration.
54       * @param date current date
55       * @return phi component of libration in radians
56       */
57      public double getPhi(final AbsoluteDate date) {
58          return getLibration(date).getX();
59      }
60  
61      /** Get the theta component of libration.
62       * @param date current date
63       * @return theta component of libration in radians
64       */
65      public double getTheta(final AbsoluteDate date) {
66          return getLibration(date).getY();
67      }
68  
69      /** Get the psi component of libration.
70       * @param date current date
71       * @return psi component of libration in radians
72       */
73      public double getPsi(final AbsoluteDate date) {
74          return getLibration(date).getZ();
75      }
76  }