HelmertTransformation.java

  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. import java.util.Optional;
  19. import java.util.stream.Stream;

  20. import org.hipparchus.CalculusFieldElement;
  21. import org.hipparchus.Field;
  22. import org.hipparchus.geometry.euclidean.threed.FieldRotation;
  23. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  24. import org.hipparchus.geometry.euclidean.threed.Rotation;
  25. import org.hipparchus.geometry.euclidean.threed.RotationConvention;
  26. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  27. import org.hipparchus.util.Precision;
  28. import org.orekit.annotation.DefaultDataContext;
  29. import org.orekit.data.DataContext;
  30. import org.orekit.time.AbsoluteDate;
  31. import org.orekit.time.DateTimeComponents;
  32. import org.orekit.time.FieldAbsoluteDate;
  33. import org.orekit.time.TimeScale;
  34. import org.orekit.utils.Constants;
  35. import org.orekit.utils.FieldPVCoordinates;
  36. import org.orekit.utils.PVCoordinates;


  37. /** Transformation class for geodetic systems.
  38.  *
  39.  * <p>The Helmert transformation is mainly used to convert between various
  40.  * realizations of geodetic frames, for example in the ITRF family.</p>
  41.  *
  42.  * <p>The original Helmert transformation is a 14 parameters transform that
  43.  * includes translation, velocity, rotation, rotation rate and scale factor.
  44.  * The scale factor is useful for coordinates near Earth surface, but it
  45.  * cannot be extended to outer space as it would correspond to a non-unitary
  46.  * transform. Therefore, the scale factor is <em>not</em> used here.
  47.  *
  48.  * <p>Instances of this class are guaranteed to be immutable.</p>
  49.  *
  50.  * @author Luc Maisonobe
  51.  * @since 5.1
  52.  */
  53. public class HelmertTransformation implements TransformProvider {

  54.     /** Enumerate for predefined Helmert transformations. */
  55.     public enum Predefined {

  56.         // see https://itrf.ign.fr/docs/solutions/itrf2020/Transfo-ITRF2020_TRFs.txt
  57.         // SOLUTION         Tx       Ty       Tz        D        Rx        Ry        Rz      EPOCH
  58.         // UNITS----------> mm       mm       mm       ppb       .001"     .001"     .001"
  59.         //                  .        .        .         .        .         .         .
  60.         //        RATES     Tx       Ty       Tz        D        Rx        Ry        Rz
  61.         // UNITS----------> mm/y     mm/y     mm/y     ppb/y    .001"/y   .001"/y   .001"/y
  62.         // -----------------------------------------------------------------------------------------
  63.         //   ITRF2014       -1.4     -0.9      1.4     -0.42      0.00      0.00      0.00    2015.0
  64.         //        rates      0.0     -0.1      0.2      0.00      0.00      0.00      0.00
  65.         //   ITRF2008        0.2      1.0      3.3     -0.29      0.00      0.00      0.00    2015.0
  66.         //        rates      0.0     -0.1      0.1      0.03      0.00      0.00      0.00
  67.         //   ITRF2005        2.7      0.1     -1.4      0.65      0.00      0.00      0.00    2015.0
  68.         //        rates      0.3     -0.1      0.1      0.03      0.00      0.00      0.00
  69.         //   ITRF2000       -0.2      0.8    -34.2      2.25      0.00      0.00      0.00    2015.0
  70.         //        rates      0.1      0.0     -1.7      0.11      0.00      0.00      0.00
  71.         //   ITRF97          6.5     -3.9    -77.9      3.98      0.00      0.00      0.36    2015.0
  72.         //        rates      0.1     -0.6     -3.1      0.12      0.00      0.00      0.02
  73.         //   ITRF96          6.5     -3.9    -77.9      3.98      0.00      0.00      0.36    2015.0
  74.         //        rates      0.1     -0.6     -3.1      0.12      0.00      0.00      0.02
  75.         //   ITRF94          6.5     -3.9    -77.9      3.98      0.00      0.00      0.36    2015.0
  76.         //        rates      0.1     -0.6     -3.1      0.12      0.00      0.00      0.02
  77.         //   ITRF93        -65.8      1.9    -71.3      4.47     -3.36     -4.33      0.75    2015.0
  78.         //        rates     -2.8     -0.2     -2.3      0.12     -0.11     -0.19      0.07
  79.         //   ITRF92         14.5     -1.9    -85.9      3.27      0.00      0.00      0.36    2015.0
  80.         //        rates      0.1     -0.6     -3.1      0.12      0.00      0.00      0.02
  81.         //   ITRF91         26.5     12.1    -91.9      4.67      0.00      0.00      0.36    2015.0
  82.         //        rates      0.1     -0.6     -3.1      0.12      0.00      0.00      0.02
  83.         //   ITRF90         24.5      8.1   -107.9      4.97      0.00      0.00      0.36    2015.0
  84.         //        rates      0.1     -0.6     -3.1      0.12      0.00      0.00      0.02
  85.         //   ITRF89         29.5     32.1   -145.9      8.37      0.00      0.00      0.36    2015.0
  86.         //        rates      0.1     -0.6     -3.1      0.12      0.00      0.00      0.02
  87.         //   ITRF88         24.5     -3.9   -169.9     11.47      0.10      0.00      0.36    2015.0
  88.         //        rates      0.1     -0.6     -3.1      0.12      0.00      0.00      0.02
  89.         // _________________________________________________________________________________________

  90.         /** Transformation from ITRF 2020 To ITRF 2014. */
  91.         ITRF_2020_TO_ITRF_2014(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_2014, 2015,
  92.                                -1.4, -0.9,   1.4,  0.00,  0.00,  0.00,
  93.                                 0.0, -0.1,   0.2,  0.00,  0.00,  0.00),

  94.         /** Transformation from ITRF 2020 To ITRF 2008. */
  95.         ITRF_2020_TO_ITRF_2008(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_2008, 2015,
  96.                                0.2,  1.0,   3.3,  0.00,  0.00,  0.00,
  97.                                0.0, -0.1,   0.1,  0.00,  0.00,  0.00),

  98.         /** Transformation from ITRF 2020 To ITRF 2005. */
  99.         ITRF_2020_TO_ITRF_2005(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_2005, 2015,
  100.                                2.7,  0.1,  -1.4,  0.00,  0.00,  0.00,
  101.                                0.3, -0.1,   0.1,  0.00,  0.00,  0.00),

  102.         /** Transformation from ITRF 2020 To ITRF 2000. */
  103.         ITRF_2020_TO_ITRF_2000(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_2000, 2015,
  104.                                -0.2,  0.8, -34.2,  0.00,  0.00,  0.00,
  105.                                 0.1,  0.0,  -1.7,  0.00,  0.00,  0.00),

  106.         /** Transformation from ITRF 2020 To ITRF 97. */
  107.         ITRF_2020_TO_ITRF_1997(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_1997, 2015,
  108.                                6.5, -3.9, -77.9,  0.00,  0.00,  0.36,
  109.                                0.1, -0.6,  -3.1,  0.00,  0.00,  0.02),

  110.         /** Transformation from ITRF 2020 To ITRF 96. */
  111.         ITRF_2020_TO_ITRF_1996(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_1996, 2015,
  112.                                6.5, -3.9, -77.9,  0.00,  0.00,  0.36,
  113.                                0.1, -0.6,  -3.1,  0.00,  0.00,  0.02),

  114.         /** Transformation from ITRF 2020 To ITRF 94. */
  115.         ITRF_2020_TO_ITRF_1994(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_1994, 2015,
  116.                                6.5, -3.9, -77.9,  0.00,  0.00,  0.36,
  117.                                0.1, -0.6,  -3.1,  0.00,  0.00,  0.02),

  118.         /** Transformation from ITRF 2020 To ITRF 93. */
  119.         ITRF_2020_TO_ITRF_1993(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_1993, 2015,
  120.                                -65.8,  1.9, -71.3, -3.36, -4.33,  0.75,
  121.                                 -2.8, -0.2,  -2.3, -0.11, -0.19,  0.07),

  122.         /** Transformation from ITRF 2020 To ITRF 92. */
  123.         ITRF_2020_TO_ITRF_1992(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_1992, 2015,
  124.                                14.5, -1.9, -85.9,  0.00,  0.00,  0.36,
  125.                                 0.1, -0.6,  -3.1,  0.00,  0.00,  0.02),

  126.         /** Transformation from ITRF 2020 To ITRF 91. */
  127.         ITRF_2020_TO_ITRF_1991(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_1991, 2015,
  128.                                26.5, 12.1, -91.9,  0.00,  0.00,  0.36,
  129.                                 0.1, -0.6,  -3.1,  0.00,  0.00,  0.02),

  130.         /** Transformation from ITRF 2020 To ITRF 90. */
  131.         ITRF_2020_TO_ITRF_1990(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_1990, 2015,
  132.                                24.5,  8.1, -107.9,  0.00,  0.00,  0.36,
  133.                                 0.1, -0.6,   -3.1,  0.00,  0.00,  0.02),

  134.         /** Transformation from ITRF 2020 To ITRF 89. */
  135.         ITRF_2020_TO_ITRF_1989(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_1989, 2015,
  136.                                29.5, 32.1, -145.9,  0.00,  0.00,  0.36,
  137.                                 0.1, -0.6,   -3.1,  0.00,  0.00,  0.02),

  138.         /** Transformation from ITRF 2020 To ITRF 88. */
  139.         ITRF_2020_TO_ITRF_1988(ITRFVersion.ITRF_2020, ITRFVersion.ITRF_1988, 2015,
  140.                                24.5, -3.9, -169.9,  0.10,  0.00,  0.36,
  141.                                 0.1, -0.6,   -3.1,  0.00,  0.00,  0.02),

  142.         // see http://itrf.ign.fr/doc_ITRF/Transfo-ITRF2014_ITRFs.txt
  143.         // SOLUTION         Tx       Ty       Tz        D        Rx        Ry        Rz      EPOCH
  144.         // UNITS----------> mm       mm       mm       ppb       .001"     .001"     .001"
  145.         //                  .        .        .         .        .         .         .
  146.         //        RATES     Tx       Ty       Tz        D        Rx        Ry        Rz
  147.         // UNITS----------> mm/y     mm/y     mm/y     ppb/y    .001"/y   .001"/y   .001"/y
  148.         // -----------------------------------------------------------------------------------------
  149.         //   ITRF2008        1.6      1.9      2.4     -0.02      0.00      0.00      0.00    2010.0
  150.         //        rates      0.0      0.0     -0.1      0.03      0.00      0.00      0.00
  151.         //   ITRF2005        2.6      1.0     -2.3      0.92      0.00      0.00      0.00    2010.0
  152.         //        rates      0.3      0.0     -0.1      0.03      0.00      0.00      0.00
  153.         //   ITRF2000        0.7      1.2    -26.1      2.12      0.00      0.00      0.00    2010.0
  154.         //        rates      0.1      0.1     -1.9      0.11      0.00      0.00      0.00
  155.         //   ITRF97          7.4     -0.5    -62.8      3.80      0.00      0.00      0.26    2010.0
  156.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  157.         //   ITRF96          7.4     -0.5    -62.8      3.80      0.00      0.00      0.26    2010.0
  158.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  159.         //   ITRF94          7.4     -0.5    -62.8      3.80      0.00      0.00      0.26    2010.0
  160.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  161.         //   ITRF93        -50.4      3.3    -60.2      4.29     -2.81     -3.38      0.40    2010.0
  162.         //        rates     -2.8     -0.1     -2.5      0.12     -0.11     -0.19      0.07
  163.         //   ITRF92         15.4      1.5    -70.8      3.09      0.00      0.00      0.26    2010.0
  164.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  165.         //   ITRF91         27.4     15.5    -76.8      4.49      0.00      0.00      0.26    2010.0
  166.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  167.         //   ITRF90         25.4     11.5    -92.8      4.79      0.00      0.00      0.26    2010.0
  168.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  169.         //   ITRF89         30.4     35.5   -130.8      8.19      0.00      0.00      0.26    2010.0
  170.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  171.         //   ITRF88         25.4     -0.5   -154.8     11.29      0.10      0.00      0.26    2010.0
  172.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  173.         // _________________________________________________________________________________________

  174.         /** Transformation from ITRF 2014 To ITRF 2008. */
  175.         ITRF_2014_TO_ITRF_2008(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_2008, 2010,
  176.                                 1.6, 1.9,     2.4, 0.00, 0.00, 0.00,
  177.                                 0.0, 0.0,    -0.1, 0.00, 0.00, 0.00),

  178.         /** Transformation from ITRF 2014 To ITRF 2005. */
  179.         ITRF_2014_TO_ITRF_2005(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_2005, 2010,
  180.                                 2.6, 1.0,    -2.3, 0.00, 0.00, 0.00,
  181.                                 0.3, 0.0,    -0.1, 0.00, 0.00, 0.00),

  182.         /** Transformation from ITRF 2014 To ITRF 2000. */
  183.         ITRF_2014_TO_ITRF_2000(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_2000, 2010,
  184.                                0.7, 1.2,   -26.1, 0.00, 0.00, 0.00,
  185.                                0.1, 0.1,    -1.9, 0.00, 0.00, 0.00),

  186.         /** Transformation from ITRF 2014 To ITRF 97. */
  187.         ITRF_2014_TO_ITRF_1997(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_1997, 2010,
  188.                                7.4, -0.5,  -62.8, 0.00, 0.00, 0.26,
  189.                                0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  190.         /** Transformation from ITRF 2014 To ITRF 96. */
  191.         ITRF_2014_TO_ITRF_1996(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_1996, 2010,
  192.                                7.4, -0.5,  -62.8, 0.00, 0.00, 0.26,
  193.                                0.1, -0.5,  -3.3, 0.00, 0.00, 0.02),

  194.         /** Transformation from ITRF 2014 To ITRF 94. */
  195.         ITRF_2014_TO_ITRF_1994(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_1994, 2010,
  196.                                7.4, -0.5,  -62.8, 0.00, 0.00, 0.26,
  197.                                0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  198.         /** Transformation from ITRF 2014 To ITRF 93. */
  199.         ITRF_2014_TO_ITRF_1993(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_1993, 2010,
  200.                                -50.4,  3.3,  -60.2, -2.81, -3.38, 0.40,
  201.                                -2.8, -0.1,   -2.5, -0.11, -0.19, 0.07),

  202.         /** Transformation from ITRF 2014 To ITRF 92. */
  203.         ITRF_2014_TO_ITRF_1992(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_1992, 2010,
  204.                                15.4,  1.5,  -70.8, 0.00, 0.00, 0.26,
  205.                                0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  206.         /** Transformation from ITRF 2014 To ITRF 91. */
  207.         ITRF_2014_TO_ITRF_1991(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_1991, 2010,
  208.                                27.4, 15.5,  -76.8, 0.00, 0.00, 0.26,
  209.                                0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  210.         /** Transformation from ITRF 2014 To ITRF 90. */
  211.         ITRF_2014_TO_ITRF_1990(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_1990, 2010,
  212.                                25.4, 11.5,  -92.8, 0.00, 0.00, 0.26,
  213.                                0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  214.         /** Transformation from ITRF 2014 To ITRF 89. */
  215.         ITRF_2014_TO_ITRF_1989(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_1989, 2010,
  216.                                30.4, 35.5, -130.8, 0.00, 0.00, 0.26,
  217.                                0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  218.         /** Transformation from ITRF 2014 To ITRF 88. */
  219.         ITRF_2014_TO_ITRF_1988(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_1988, 2010,
  220.                                25.4, -0.5, -154.8, 0.10, 0.00, 0.26,
  221.                                0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  222.         // see http://itrf.ensg.ign.fr/doc_ITRF/Transfo-ITRF2008_ITRFs.txt
  223.         // SOLUTION         Tx       Ty       Tz        D        Rx        Ry        Rz      EPOCH
  224.         // UNITS----------> mm       mm       mm       ppb       .001"     .001"     .001"
  225.         //                         .        .        .         .        .         .         .
  226.         //        RATES     Tx       Ty       Tz        D        Rx        Ry        Rz
  227.         // UNITS----------> mm/y     mm/y     mm/y     ppb/y    .001"/y   .001"/y   .001"/y
  228.         // -----------------------------------------------------------------------------------------
  229.         //   ITRF2005       -2.0     -0.9     -4.7      0.94      0.00      0.00      0.00    2000.0
  230.         //        rates      0.3      0.0      0.0      0.00      0.00      0.00      0.00
  231.         //   ITRF2000       -1.9     -1.7    -10.5      1.34      0.00      0.00      0.00    2000.0
  232.         //        rates      0.1      0.1     -1.8      0.08      0.00      0.00      0.00
  233.         //   ITRF97          4.8      2.6    -33.2      2.92      0.00      0.00      0.06    2000.0
  234.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  235.         //   ITRF96          4.8      2.6    -33.2      2.92      0.00      0.00      0.06    2000.0
  236.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  237.         //   ITRF94          4.8      2.6    -33.2      2.92      0.00      0.00      0.06    2000.0
  238.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  239.         //   ITRF93        -24.0      2.4    -38.6      3.41     -1.71     -1.48     -0.30    2000.0
  240.         //        rates     -2.8     -0.1     -2.4      0.09     -0.11     -0.19      0.07
  241.         //   ITRF92         12.8      4.6    -41.2      2.21      0.00      0.00      0.06    2000.0
  242.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  243.         //   ITRF91         24.8     18.6    -47.2      3.61      0.00      0.00      0.06    2000.0
  244.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  245.         //   ITRF90         22.8     14.6    -63.2      3.91      0.00      0.00      0.06    2000.0
  246.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  247.         //   ITRF89         27.8     38.6   -101.2      7.31      0.00      0.00      0.06    2000.0
  248.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  249.         //   ITRF88         22.8      2.6   -125.2     10.41      0.10      0.00      0.06    2000.0
  250.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  251.         // _________________________________________________________________________________________

  252.         /** Transformation from ITRF 2008 To ITRF 2005. */
  253.         ITRF_2008_TO_ITRF_2005(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_2005, 2000,
  254.                                -2.0, -0.9,   -4.7,  0.00,  0.00,  0.00,
  255.                                 0.3,  0.0,    0.0,  0.00,  0.00,  0.00),

  256.         /** Transformation from ITRF 2008 To ITRF 2000. */
  257.         ITRF_2008_TO_ITRF_2000(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_2000, 2000,
  258.                                -1.9, -1.7,  -10.5,  0.00,  0.00,  0.00,
  259.                                 0.1,  0.1,   -1.8,  0.00,  0.00,  0.00),

  260.         /** Transformation from ITRF 2008 To ITRF 97. */
  261.         ITRF_2008_TO_ITRF_1997(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_1997, 2000,
  262.                                4.8,  2.6,  -33.2,  0.00,  0.00,  0.06,
  263.                                0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  264.         /** Transformation from ITRF 2008 To ITRF 96. */
  265.         ITRF_2008_TO_ITRF_1996(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_1996, 2000,
  266.                                4.8,  2.6,  -33.2,  0.00,  0.00,  0.06,
  267.                                0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  268.         /** Transformation from ITRF 2008 To ITRF 94. */
  269.         ITRF_2008_TO_ITRF_1994(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_1994, 2000,
  270.                                4.8,  2.6,  -33.2,  0.00,  0.00,  0.06,
  271.                                0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  272.         /** Transformation from ITRF 2008 To ITRF 93. */
  273.         ITRF_2008_TO_ITRF_1993(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_1993, 2000,
  274.                                -24.0,  2.4,  -38.6, -1.71, -1.48, -0.30,
  275.                                -2.8, -0.1,   -2.4, -0.11, -0.19,  0.07),

  276.         /** Transformation from ITRF 2008 To ITRF 92. */
  277.         ITRF_2008_TO_ITRF_1992(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_1992, 2000,
  278.                                12.8,  4.6,  -41.2,  0.00,  0.00,  0.06,
  279.                                0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  280.         /** Transformation from ITRF 2008 To ITRF 91. */
  281.         ITRF_2008_TO_ITRF_1991(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_1991, 2000,
  282.                                24.8, 18.6,  -47.2,  0.00,  0.00,  0.06,
  283.                                0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  284.         /** Transformation from ITRF 2008 To ITRF 90. */
  285.         ITRF_2008_TO_ITRF_1990(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_1990, 2000,
  286.                                22.8, 14.6,  -63.2,  0.00,  0.00,  0.06,
  287.                                0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  288.         /** Transformation from ITRF 2008 To ITRF 89. */
  289.         ITRF_2008_TO_ITRF_1989(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_1989, 2000,
  290.                                27.8, 38.6, -101.2,  0.00,  0.00,  0.06,
  291.                                0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  292.         /** Transformation from ITRF 2008 To ITRF 88. */
  293.         ITRF_2008_TO_ITRF_1988(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_1988, 2000,
  294.                                22.8,  2.6, -125.2,  0.10,  0.00,  0.06,
  295.                                0.1, -0.5,   -3.2,  0.00,  0.00,  0.02);

  296.         /** Origin ITRF. */
  297.         private final ITRFVersion origin;

  298.         /** Destination ITRF. */
  299.         private final ITRFVersion destination;

  300.         /** Transformation. */
  301.         private final transient HelmertTransformationWithoutTimeScale transformation;

  302.         /** Simple constructor.
  303.          * @param origin origin ITRF
  304.          * @param destination destination ITRF
  305.          * @param refYear reference year for the epoch of the transform
  306.          * @param t1 translation parameter along X axis (BEWARE, this is in mm)
  307.          * @param t2 translation parameter along Y axis (BEWARE, this is in mm)
  308.          * @param t3 translation parameter along Z axis (BEWARE, this is in mm)
  309.          * @param r1 rotation parameter around X axis (BEWARE, this is in mas)
  310.          * @param r2 rotation parameter around Y axis (BEWARE, this is in mas)
  311.          * @param r3 rotation parameter around Z axis (BEWARE, this is in mas)
  312.          * @param t1Dot rate of translation parameter along X axis (BEWARE, this is in mm/y)
  313.          * @param t2Dot rate of translation parameter along Y axis (BEWARE, this is in mm/y)
  314.          * @param t3Dot rate of translation parameter along Z axis (BEWARE, this is in mm/y)
  315.          * @param r1Dot rate of rotation parameter around X axis (BEWARE, this is in mas/y)
  316.          * @param r2Dot rate of rotation parameter around Y axis (BEWARE, this is in mas/y)
  317.          * @param r3Dot rate of rotation parameter around Z axis (BEWARE, this is in mas/y)
  318.          */
  319.         Predefined(final ITRFVersion origin, final ITRFVersion destination, final int refYear,
  320.                    final double t1, final double t2, final double t3,
  321.                    final double r1, final double r2, final double r3,
  322.                    final double t1Dot, final double t2Dot, final double t3Dot,
  323.                    final double r1Dot, final double r2Dot, final double r3Dot) {
  324.             this.origin         = origin;
  325.             this.destination    = destination;
  326.             this.transformation =
  327.                     new HelmertTransformationWithoutTimeScale(new DateTimeComponents(refYear, 1, 1, 12, 0, 0),
  328.                                               t1, t2, t3, r1, r2, r3, t1Dot, t2Dot, t3Dot, r1Dot, r2Dot, r3Dot);
  329.         }

  330.         /** Get the origin ITRF.
  331.          * @return origin ITRF
  332.          * @since 9.2
  333.          */
  334.         public ITRFVersion getOrigin() {
  335.             return origin;
  336.         }

  337.         /** Get the destination ITRF.
  338.          * @return destination ITRF
  339.          * @since 9.2
  340.          */
  341.         public ITRFVersion getDestination() {
  342.             return destination;
  343.         }

  344.         /** Get the underlying {@link HelmertTransformation}.
  345.          *
  346.          * <p>This method uses the {@link DataContext#getDefault() default data context}.
  347.          *
  348.          * @return underlying {@link HelmertTransformation}
  349.          * @since 9.2
  350.          * @see #getTransformation(TimeScale)
  351.          */
  352.         @DefaultDataContext
  353.         public HelmertTransformation getTransformation() {
  354.             return getTransformation(DataContext.getDefault().getTimeScales().getTT());
  355.         }

  356.         /** Get the underlying {@link HelmertTransformation}.
  357.          * @return underlying {@link HelmertTransformation}
  358.          * @param tt TT time scale.
  359.          * @since 10.1
  360.          */
  361.         public HelmertTransformation getTransformation(final TimeScale tt) {
  362.             return transformation.withTimeScale(tt);
  363.         }

  364.         /** Create an ITRF frame by transforming another ITRF frame.
  365.          *
  366.          * <p>This method uses the {@link DataContext#getDefault() default data context}.
  367.          *
  368.          * @param parent parent ITRF frame
  369.          * @param name name of the frame to create
  370.          * @return new ITRF frame
  371.          * @see #createTransformedITRF(Frame, String, TimeScale)
  372.          */
  373.         @DefaultDataContext
  374.         public Frame createTransformedITRF(final Frame parent, final String name) {
  375.             return createTransformedITRF(parent, name,
  376.                     DataContext.getDefault().getTimeScales().getTT());
  377.         }

  378.         /** Create an ITRF frame by transforming another ITRF frame.
  379.          * @param parent parent ITRF frame
  380.          * @param name name of the frame to create
  381.          * @param tt TT time scale.
  382.          * @return new ITRF frame
  383.          * @since 10.1
  384.          */
  385.         public Frame createTransformedITRF(final Frame parent,
  386.                                            final String name,
  387.                                            final TimeScale tt) {
  388.             return new Frame(parent, getTransformation(tt), name);
  389.         }

  390.         /** Select a predefined transform between two years.
  391.          * @param origin origin year
  392.          * @param destination destination year
  393.          * @return predefined transform from origin to destination, or null if no such predefined transform exist
  394.          * @since 11.2
  395.          */
  396.         public static Predefined selectPredefined(final int origin, final int destination) {
  397.             final Optional<HelmertTransformation.Predefined> optional =
  398.                             Stream.
  399.                             of(HelmertTransformation.Predefined.values()).
  400.                             filter(p -> p.getOrigin().getYear() == origin && p.getDestination().getYear() == destination).
  401.                             findFirst();
  402.             return optional.isPresent() ? optional.get() : null;
  403.         }

  404.     }

  405.     /**
  406.      * A {@link HelmertTransformation} without reference to a {@link TimeScale}. This
  407.      * class is needed to maintain compatibility with Orekit 10.0 since {@link Predefined}
  408.      * is an enum and it had a reference to the TT time scale.
  409.      */
  410.     private static class HelmertTransformationWithoutTimeScale {

  411.         /** Cartesian part of the transform. */
  412.         private final PVCoordinates cartesian;

  413.         /** Global rotation vector (applying rotation is done by computing cross product). */
  414.         private final Vector3D rotationVector;

  415.         /** First time derivative of the rotation (norm representing angular rate). */
  416.         private final Vector3D rotationRate;

  417.         /** Reference epoch of the transform. */
  418.         private final DateTimeComponents epoch;

  419.         /** Build a transform from its primitive operations.
  420.          * @param epoch reference epoch of the transform
  421.          * @param t1 translation parameter along X axis (BEWARE, this is in mm)
  422.          * @param t2 translation parameter along Y axis (BEWARE, this is in mm)
  423.          * @param t3 translation parameter along Z axis (BEWARE, this is in mm)
  424.          * @param r1 rotation parameter around X axis (BEWARE, this is in mas)
  425.          * @param r2 rotation parameter around Y axis (BEWARE, this is in mas)
  426.          * @param r3 rotation parameter around Z axis (BEWARE, this is in mas)
  427.          * @param t1Dot rate of translation parameter along X axis (BEWARE, this is in mm/y)
  428.          * @param t2Dot rate of translation parameter along Y axis (BEWARE, this is in mm/y)
  429.          * @param t3Dot rate of translation parameter along Z axis (BEWARE, this is in mm/y)
  430.          * @param r1Dot rate of rotation parameter around X axis (BEWARE, this is in mas/y)
  431.          * @param r2Dot rate of rotation parameter around Y axis (BEWARE, this is in mas/y)
  432.          * @param r3Dot rate of rotation parameter around Z axis (BEWARE, this is in mas/y)
  433.          */
  434.         HelmertTransformationWithoutTimeScale(
  435.                 final DateTimeComponents epoch,
  436.                 final double t1, final double t2, final double t3,
  437.                 final double r1, final double r2, final double r3,
  438.                 final double t1Dot, final double t2Dot, final double t3Dot,
  439.                 final double r1Dot, final double r2Dot, final double r3Dot) {

  440.             // conversion parameters to SI units
  441.             final double mmToM    = 1.0e-3;
  442.             final double masToRad = 1.0e-3 * Constants.ARC_SECONDS_TO_RADIANS;

  443.             this.epoch          = epoch;
  444.             this.cartesian = new PVCoordinates(new Vector3D(t1 * mmToM,
  445.                     t2 * mmToM,
  446.                     t3 * mmToM),
  447.                     new Vector3D(t1Dot * mmToM / Constants.JULIAN_YEAR,
  448.                             t2Dot * mmToM / Constants.JULIAN_YEAR,
  449.                             t3Dot * mmToM / Constants.JULIAN_YEAR));
  450.             this.rotationVector = new Vector3D(r1 * masToRad,
  451.                     r2 * masToRad,
  452.                     r3 * masToRad);
  453.             this.rotationRate   = new Vector3D(r1Dot * masToRad / Constants.JULIAN_YEAR,
  454.                     r2Dot * masToRad / Constants.JULIAN_YEAR,
  455.                     r3Dot * masToRad / Constants.JULIAN_YEAR);

  456.         }

  457.         /**
  458.          * Get the Helmert transformation with reference to the given time scale.
  459.          *
  460.          * @param tt TT time scale.
  461.          * @return Helmert transformation.
  462.          */
  463.         public HelmertTransformation withTimeScale(final TimeScale tt) {
  464.             return new HelmertTransformation(cartesian, rotationVector, rotationRate,
  465.                     new AbsoluteDate(epoch, tt));
  466.         }

  467.     }

  468.     /** Cartesian part of the transform. */
  469.     private final PVCoordinates cartesian;

  470.     /** Global rotation vector (applying rotation is done by computing cross product). */
  471.     private final Vector3D rotationVector;

  472.     /** First time derivative of the rotation (norm representing angular rate). */
  473.     private final Vector3D rotationRate;

  474.     /** Reference epoch of the transform. */
  475.     private final AbsoluteDate epoch;

  476.     /** Build a transform from its primitive operations.
  477.      * @param epoch reference epoch of the transform
  478.      * @param t1 translation parameter along X axis (BEWARE, this is in mm)
  479.      * @param t2 translation parameter along Y axis (BEWARE, this is in mm)
  480.      * @param t3 translation parameter along Z axis (BEWARE, this is in mm)
  481.      * @param r1 rotation parameter around X axis (BEWARE, this is in mas)
  482.      * @param r2 rotation parameter around Y axis (BEWARE, this is in mas)
  483.      * @param r3 rotation parameter around Z axis (BEWARE, this is in mas)
  484.      * @param t1Dot rate of translation parameter along X axis (BEWARE, this is in mm/y)
  485.      * @param t2Dot rate of translation parameter along Y axis (BEWARE, this is in mm/y)
  486.      * @param t3Dot rate of translation parameter along Z axis (BEWARE, this is in mm/y)
  487.      * @param r1Dot rate of rotation parameter around X axis (BEWARE, this is in mas/y)
  488.      * @param r2Dot rate of rotation parameter around Y axis (BEWARE, this is in mas/y)
  489.      * @param r3Dot rate of rotation parameter around Z axis (BEWARE, this is in mas/y)
  490.      */
  491.     public HelmertTransformation(final AbsoluteDate epoch,
  492.                                  final double t1, final double t2, final double t3,
  493.                                  final double r1, final double r2, final double r3,
  494.                                  final double t1Dot, final double t2Dot, final double t3Dot,
  495.                                  final double r1Dot, final double r2Dot, final double r3Dot) {

  496.         // conversion parameters to SI units
  497.         final double mmToM    = 1.0e-3;
  498.         final double masToRad = 1.0e-3 * Constants.ARC_SECONDS_TO_RADIANS;

  499.         this.epoch          = epoch;
  500.         this.cartesian = new PVCoordinates(new Vector3D(t1 * mmToM,
  501.                                                         t2 * mmToM,
  502.                                                         t3 * mmToM),
  503.                                            new Vector3D(t1Dot * mmToM / Constants.JULIAN_YEAR,
  504.                                                         t2Dot * mmToM / Constants.JULIAN_YEAR,
  505.                                                         t3Dot * mmToM / Constants.JULIAN_YEAR));
  506.         this.rotationVector = new Vector3D(r1 * masToRad,
  507.                                            r2 * masToRad,
  508.                                            r3 * masToRad);
  509.         this.rotationRate   = new Vector3D(r1Dot * masToRad / Constants.JULIAN_YEAR,
  510.                                            r2Dot * masToRad / Constants.JULIAN_YEAR,
  511.                                            r3Dot * masToRad / Constants.JULIAN_YEAR);

  512.     }

  513.     /**
  514.      * Private constructor.
  515.      *
  516.      * @param cartesian      part of the transform.
  517.      * @param rotationVector global rotation vector.
  518.      * @param rotationRate   time derivative of rotation.
  519.      * @param epoch          of transform.
  520.      */
  521.     private HelmertTransformation(final PVCoordinates cartesian,
  522.                                   final Vector3D rotationVector,
  523.                                   final Vector3D rotationRate,
  524.                                   final AbsoluteDate epoch) {
  525.         this.cartesian = cartesian;
  526.         this.rotationVector = rotationVector;
  527.         this.rotationRate = rotationRate;
  528.         this.epoch = epoch;
  529.     }

  530.     /** Get the reference epoch of the transform.
  531.      * @return reference epoch of the transform
  532.      */
  533.     public AbsoluteDate getEpoch() {
  534.         return epoch;
  535.     }

  536.     /** {@inheritDoc} */
  537.     @Override
  538.     public Transform getTransform(final AbsoluteDate date) {

  539.         // compute parameters evolution since reference epoch
  540.         final double dt = date.durationFrom(epoch);
  541.         final Vector3D dR = new Vector3D(1, rotationVector, dt, rotationRate);

  542.         // build translation part
  543.         final Transform translationTransform = new Transform(date, cartesian.shiftedBy(dt));

  544.         // build rotation part
  545.         final double angle = dR.getNorm();
  546.         final Transform rotationTransform =
  547.                 new Transform(date,
  548.                               (angle < Precision.SAFE_MIN) ?
  549.                               Rotation.IDENTITY :
  550.                               new Rotation(dR, angle, RotationConvention.VECTOR_OPERATOR),
  551.                               rotationRate);

  552.         // combine both parts
  553.         return new Transform(date, translationTransform, rotationTransform);

  554.     }

  555.     /** {@inheritDoc} */
  556.     @Override
  557.     public StaticTransform getStaticTransform(final AbsoluteDate date) {

  558.         // compute parameters evolution since reference epoch
  559.         final double dt = date.durationFrom(epoch);
  560.         final Vector3D dR = new Vector3D(1, rotationVector, dt, rotationRate);

  561.         // build translation part
  562.         final Vector3D translation = cartesian.shiftedBy(dt).getPosition();

  563.         // build rotation part
  564.         final double angle = dR.getNorm();
  565.         final Rotation rotation = (angle < Precision.SAFE_MIN) ?
  566.                 Rotation.IDENTITY :
  567.                 new Rotation(dR, angle, RotationConvention.VECTOR_OPERATOR);

  568.         // combine both parts
  569.         return StaticTransform.of(date, translation, rotation);

  570.     }

  571.     /** {@inheritDoc} */
  572.     @Override
  573.     public <T extends CalculusFieldElement<T>> FieldTransform<T> getTransform(final FieldAbsoluteDate<T> date) {

  574.         // compute parameters evolution since reference epoch
  575.         final T dt = date.durationFrom(epoch);
  576.         final FieldVector3D<T> dR = new FieldVector3D<>(date.getField().getOne(), rotationVector,
  577.                                                         dt, rotationRate);

  578.         // build translation part
  579.         final FieldTransform<T> translationTransform =
  580.                         new FieldTransform<>(date,
  581.                                              new FieldPVCoordinates<>(date.getField(), cartesian).shiftedBy(dt));

  582.         // build rotation part
  583.         final T angle = dR.getNorm();
  584.         final FieldTransform<T> rotationTransform =
  585.                 new FieldTransform<>(date,
  586.                                     (angle.getReal() < Precision.SAFE_MIN) ?
  587.                                      FieldRotation.getIdentity(date.getField()) :
  588.                                     new FieldRotation<>(dR, angle, RotationConvention.VECTOR_OPERATOR),
  589.                                     new FieldVector3D<>(date.getField(), rotationRate));

  590.         // combine both parts
  591.         return new FieldTransform<>(date, translationTransform, rotationTransform);

  592.     }

  593.     /** {@inheritDoc} */
  594.     @Override
  595.     public <T extends CalculusFieldElement<T>> FieldStaticTransform<T> getStaticTransform(final FieldAbsoluteDate<T> date) {

  596.         // field
  597.         final Field<T> field = date.getField();

  598.         // compute parameters evolution since reference epoch
  599.         final T dt = date.durationFrom(epoch);
  600.         final FieldVector3D<T> dR = new FieldVector3D<>(field.getOne(), rotationVector, dt, rotationRate);

  601.         // build translation part
  602.         final FieldVector3D<T> translation = new FieldPVCoordinates<>(date.getField(), cartesian).shiftedBy(dt).getPosition();

  603.         // build rotation part
  604.         final T angle = dR.getNorm();
  605.         final FieldRotation<T> rotation = (angle.getReal() < Precision.SAFE_MIN) ?
  606.                 FieldRotation.getIdentity(field) :
  607.                 new FieldRotation<>(dR, angle, RotationConvention.VECTOR_OPERATOR);

  608.         // combine both parts
  609.         return FieldStaticTransform.of(date, translation, rotation);

  610.     }

  611. }