ValsecchiEncounterFrame.java

  1. /* Copyright 2002-2024 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.encounter;

  18. import org.hipparchus.CalculusFieldElement;
  19. import org.hipparchus.Field;
  20. import org.hipparchus.geometry.euclidean.threed.FieldRotation;
  21. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  22. import org.hipparchus.geometry.euclidean.threed.Rotation;
  23. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  24. import org.orekit.utils.FieldPVCoordinates;
  25. import org.orekit.utils.PVCoordinates;

  26. /**
  27.  * Valsecchi encounter local orbital frame based on Valsecchi formulation from : "Valsecchi, G. B., Milani, A., Gronchi, G.
  28.  * F. & Ches- ley, S. R. Resonant returns to close approaches: Analytical theory. Astronomy & Astrophysics 408,
  29.  * 1179–1196 (2003).".
  30.  * <p>
  31.  * Note that <b>it is up to the user</b> to choose which object should be at the origin.
  32.  *
  33.  * @author Vincent Cucchietti
  34.  * @author Quentin Parpaite
  35.  * @since 12.0
  36.  */
  37. public class ValsecchiEncounterFrame extends AbstractEncounterLOF {

  38.     /**
  39.      * Constructor.
  40.      *
  41.      * @param other other object to create the encounter frame with (not the origin of the frame !)
  42.      */
  43.     public ValsecchiEncounterFrame(final PVCoordinates other) {
  44.         super(other);
  45.     }

  46.     /**
  47.      * Constructor.
  48.      *
  49.      * @param other other object to create the encounter frame with (not the origin of the frame !)
  50.      * @param <T> type of the field elements
  51.      */
  52.     public <T extends CalculusFieldElement<T>> ValsecchiEncounterFrame(final FieldPVCoordinates<T> other) {
  53.         super(other);
  54.     }

  55.     /** {@inheritDoc} */
  56.     @Override
  57.     public <T extends CalculusFieldElement<T>> FieldRotation<T> rotationFromInertial(final Field<T> field,
  58.                                                                                      final FieldPVCoordinates<T> origin,
  59.                                                                                      final FieldPVCoordinates<T> other) {
  60.         final FieldVector3D<T> otherVelocity = other.getVelocity();

  61.         final FieldVector3D<T> xAxis = origin.getVelocity().crossProduct(otherVelocity).normalize();
  62.         final FieldVector3D<T> yAxis = otherVelocity.subtract(origin.getVelocity()).normalize();

  63.         return new FieldRotation<>(xAxis, yAxis, FieldVector3D.getPlusI(field), FieldVector3D.getPlusJ(field));
  64.     }

  65.     /** {@inheritDoc} */
  66.     @Override
  67.     public Rotation rotationFromInertial(final PVCoordinates origin, final PVCoordinates other) {
  68.         final Vector3D xAxis = origin.getVelocity().crossProduct(other.getVelocity()).normalize();
  69.         final Vector3D yAxis = other.getVelocity().subtract(origin.getVelocity()).normalize();

  70.         return new Rotation(xAxis, yAxis, Vector3D.PLUS_I, Vector3D.PLUS_J);
  71.     }

  72.     /**
  73.      * {@inheritDoc}
  74.      * <p>
  75.      * In this case, return (0,1,0);
  76.      */
  77.     @Override
  78.     public <T extends CalculusFieldElement<T>> FieldVector3D<T> getAxisNormalToCollisionPlane(final Field<T> field) {
  79.         return FieldVector3D.getPlusJ(field);
  80.     }

  81.     /**
  82.      * {@inheritDoc}
  83.      * <p>
  84.      * In this case, return (0,1,0);
  85.      */
  86.     @Override
  87.     public Vector3D getAxisNormalToCollisionPlane() {
  88.         return Vector3D.PLUS_J;
  89.     }

  90.     /** {@inheritDoc} */
  91.     @Override
  92.     public String getName() {
  93.         return "VALSECCHI_ENCOUNTER_LOF";
  94.     }
  95. }