FieldInertiaAxis.java

  1. /* Copyright 2023 Luc Maisonobe
  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.FieldVector3D;


  20. /** Container for inertial axis.
  21.  * <p>
  22.  * Instances of this class are immutable
  23.  * </p>
  24.  * @param <T> type fof the field elements
  25.  * @author Luc Maisonobe
  26.  * @since 12.0
  27.  */
  28. public class FieldInertiaAxis<T extends CalculusFieldElement<T>> {

  29.     /** Moment of inertia. */
  30.     private final T i;

  31.     /** Inertia axis. */
  32.     private final FieldVector3D<T> a;

  33.     /** Simple constructor to pair a moment of inertia with its associated axis.
  34.      * @param i moment of inertia
  35.      * @param a inertia axis
  36.      */
  37.     public FieldInertiaAxis(final T i, final FieldVector3D<T> a) {
  38.         this.i = i;
  39.         this.a = a;
  40.     }

  41.     /** Reverse the inertia axis.
  42.      * @return new container with reversed axis
  43.      */
  44.     public FieldInertiaAxis<T> negate() {
  45.         return new FieldInertiaAxis<>(i, a.negate());
  46.     }

  47.     /** Get the moment of inertia.
  48.      * @return moment of inertia
  49.      */
  50.     public T getI() {
  51.         return i;
  52.     }

  53.     /** Get the inertia axis.
  54.      * @return inertia axis
  55.      */
  56.     public FieldVector3D<T> getA() {
  57.         return a;
  58.     }

  59. }