StateVector.java

  1. /* Copyright 2002-2023 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.files.ccsds.ndm.cdm;

  18. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  19. import org.orekit.files.ccsds.ndm.odm.StateVectorKey;
  20. import org.orekit.files.ccsds.section.CommentsContainer;

  21. /**
  22.  * Container for state vector data.
  23.  * @author Melina Vanel
  24.  * @since 11.2
  25.  */
  26. public class StateVector extends CommentsContainer {

  27.     /** Object Position Vector X component. */
  28.     private double x;

  29.     /** Object Position Vector Y component. */
  30.     private double y;

  31.     /** Object Position Vector Z component. */
  32.     private double z;

  33.     /** Object Velocity Vector X component. */
  34.     private double xDot;

  35.     /** Object Velocity Vector Y component. */
  36.     private double yDot;

  37.     /** Object Velocity Vector Z component. */
  38.     private double zDot;

  39.     /** Simple constructor.
  40.      */
  41.     public StateVector() {
  42.         x         = Double.NaN;
  43.         y         = Double.NaN;
  44.         z         = Double.NaN;
  45.         xDot      = Double.NaN;
  46.         yDot      = Double.NaN;
  47.         zDot      = Double.NaN;
  48.     }

  49.     /** {@inheritDoc} */
  50.     @Override
  51.     public void validate(final double version) {
  52.         super.validate(version);
  53.         checkNotNaN(x, StateVectorKey.X.name());
  54.         checkNotNaN(y, StateVectorKey.Y.name());
  55.         checkNotNaN(z, StateVectorKey.Z.name());
  56.         checkNotNaN(xDot, StateVectorKey.X_DOT.name());
  57.         checkNotNaN(yDot, StateVectorKey.Y_DOT.name());
  58.         checkNotNaN(zDot, StateVectorKey.Z_DOT.name());

  59.     }

  60.     /**
  61.      * Set object Position Vector X component.
  62.      * @param X object Position Vector X component (in m)
  63.      */
  64.     public void setX(final double X) {
  65.         refuseFurtherComments();
  66.         this.x = X;
  67.     }

  68.     /**
  69.      * Set object Position Vector Y component.
  70.      * @param Y object Position Vector Y component (in m)
  71.      */
  72.     public void setY(final double Y) {
  73.         refuseFurtherComments();
  74.         this.y = Y;
  75.     }

  76.     /**
  77.      * Set object Position Vector Z component.
  78.      * @param Z object Position Vector Z component (in m)
  79.      */
  80.     public void setZ(final double Z) {
  81.         refuseFurtherComments();
  82.         this.z = Z;
  83.     }

  84.     /**
  85.      * Set object Velocity Vector X component.
  86.      * @param Xdot object Velocity Vector X component (in m/s)
  87.      */
  88.     public void setXdot(final double Xdot) {
  89.         refuseFurtherComments();
  90.         this.xDot = Xdot;
  91.     }

  92.     /**
  93.      * Set object Velocity Vector Y component.
  94.      * @param Ydot object Velocity Vector Y component (in m/s)
  95.      */
  96.     public void setYdot(final double Ydot) {
  97.         refuseFurtherComments();
  98.         this.yDot = Ydot;
  99.     }

  100.     /**
  101.      * Set object Velocity Vector Z component.
  102.      * @param Zdot object Velocity Vector Z component (in m/s)
  103.      */
  104.     public void setZdot(final double Zdot) {
  105.         refuseFurtherComments();
  106.         this.zDot = Zdot;
  107.     }

  108.     /**
  109.      * Get object Position Vector.
  110.      * @return object Position Vector (in m)
  111.      */
  112.     public Vector3D getPositionVector() {
  113.         return new Vector3D(x, y, z);
  114.     }

  115.     /**
  116.      * Get object Velocity Vector.
  117.      * @return object Velocity Vector (in m/s)
  118.      */
  119.     public Vector3D getVelocityVector() {
  120.         return new Vector3D(xDot, yDot, zDot);
  121.     }


  122. }