HelmertTransformation.java

  1. /* Copyright 2002-2020 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 org.hipparchus.RealFieldElement;
  19. import org.hipparchus.geometry.euclidean.threed.FieldRotation;
  20. import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
  21. import org.hipparchus.geometry.euclidean.threed.Rotation;
  22. import org.hipparchus.geometry.euclidean.threed.RotationConvention;
  23. import org.hipparchus.geometry.euclidean.threed.Vector3D;
  24. import org.hipparchus.util.Precision;
  25. import org.orekit.annotation.DefaultDataContext;
  26. import org.orekit.data.DataContext;
  27. import org.orekit.time.AbsoluteDate;
  28. import org.orekit.time.DateTimeComponents;
  29. import org.orekit.time.FieldAbsoluteDate;
  30. import org.orekit.time.TimeScale;
  31. import org.orekit.utils.Constants;
  32. import org.orekit.utils.FieldPVCoordinates;
  33. import org.orekit.utils.PVCoordinates;


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

  51.     /** serializable UID. */
  52.     private static final long serialVersionUID = -1900615992141291146L;

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

  55.         // see http://itrf.ign.fr/doc_ITRF/Transfo-ITRF2014_ITRFs.txt
  56.         // SOLUTION         Tx       Ty       Tz        D        Rx        Ry        Rz      EPOCH
  57.         // UNITS----------> mm       mm       mm       ppb       .001"     .001"     .001"
  58.         //                  .        .        .         .        .         .         .
  59.         //        RATES     Tx       Ty       Tz        D        Rx        Ry        Rz
  60.         // UNITS----------> mm/y     mm/y     mm/y     ppb/y    .001"/y   .001"/y   .001"/y
  61.         // -----------------------------------------------------------------------------------------
  62.         //   ITRF2008        1.6      1.9      2.4     -0.02      0.00      0.00      0.00    2010.0
  63.         //        rates      0.0      0.0     -0.1      0.03      0.00      0.00      0.00
  64.         //   ITRF2005        2.6      1.0     -2.3      0.92      0.00      0.00      0.00    2010.0
  65.         //        rates      0.3      0.0     -0.1      0.03      0.00      0.00      0.00
  66.         //   ITRF2000        0.7      1.2    -26.1      2.12      0.00      0.00      0.00    2010.0
  67.         //        rates      0.1      0.1     -1.9      0.11      0.00      0.00      0.00
  68.         //   ITRF97          7.4     -0.5    -62.8      3.80      0.00      0.00      0.26    2010.0
  69.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  70.         //   ITRF96          7.4     -0.5    -62.8      3.80      0.00      0.00      0.26    2010.0
  71.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  72.         //   ITRF94          7.4     -0.5    -62.8      3.80      0.00      0.00      0.26    2010.0
  73.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  74.         //   ITRF93        -50.4      3.3    -60.2      4.29     -2.81     -3.38      0.40    2010.0
  75.         //        rates     -2.8     -0.1     -2.5      0.12     -0.11     -0.19      0.07
  76.         //   ITRF92         15.4      1.5    -70.8      3.09      0.00      0.00      0.26    2010.0
  77.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  78.         //   ITRF91         27.4     15.5    -76.8      4.49      0.00      0.00      0.26    2010.0
  79.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  80.         //   ITRF90         25.4     11.5    -92.8      4.79      0.00      0.00      0.26    2010.0
  81.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  82.         //   ITRF89         30.4     35.5   -130.8      8.19      0.00      0.00      0.26    2010.0
  83.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  84.         //   ITRF88         25.4     -0.5   -154.8     11.29      0.10      0.00      0.26    2010.0
  85.         //        rates      0.1     -0.5     -3.3      0.12      0.00      0.00      0.02
  86.         // _________________________________________________________________________________________

  87.         /** Transformation from ITRF 2014 To ITRF 2008. */
  88.         ITRF_2014_TO_ITRF_2008(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_2008, 2010,
  89.                                 1.6, 1.9,     2.4, 0.00, 0.00, 0.00,
  90.                                 0.0, 0.0,    -0.1, 0.00, 0.00, 0.00),

  91.         /** Transformation from ITRF 2014 To ITRF 2005. */
  92.         ITRF_2014_TO_ITRF_2005(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_2005, 2010,
  93.                                 2.6, 1.0,    -2.3, 0.00, 0.00, 0.00,
  94.                                 0.3, 0.0,    -0.1, 0.00, 0.00, 0.00),

  95.         /** Transformation from ITRF 2014 To ITRF 2000. */
  96.         ITRF_2014_TO_ITRF_2000(ITRFVersion.ITRF_2014, ITRFVersion.ITRF_2000, 2010,
  97.                                 0.7, 1.2,   -26.1, 0.00, 0.00, 0.00,
  98.                                 0.1, 0.1,    -1.9, 0.00, 0.00, 0.00),

  99.         /** Transformation from ITRF 2014 To ITRF 97. */
  100.         ITRF_2014_TO_ITRF_97  (ITRFVersion.ITRF_2014, ITRFVersion.ITRF_97, 2010,
  101.                                 7.4, -0.5,  -62.8, 0.00, 0.00, 0.26,
  102.                                 0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  103.         /** Transformation from ITRF 2014 To ITRF 96. */
  104.         ITRF_2014_TO_ITRF_96  (ITRFVersion.ITRF_2014, ITRFVersion.ITRF_96, 2010,
  105.                                 7.4, -0.5,  -62.8, 0.00, 0.00, 0.26,
  106.                                 0.1, -0.5,  -3.3, 0.00, 0.00, 0.02),

  107.         /** Transformation from ITRF 2014 To ITRF 94. */
  108.         ITRF_2014_TO_ITRF_94  (ITRFVersion.ITRF_2014, ITRFVersion.ITRF_94, 2010,
  109.                                 7.4, -0.5,  -62.8, 0.00, 0.00, 0.26,
  110.                                 0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  111.         /** Transformation from ITRF 2014 To ITRF 93. */
  112.         ITRF_2014_TO_ITRF_93  (ITRFVersion.ITRF_2014, ITRFVersion.ITRF_93, 2010,
  113.                               -50.4,  3.3,  -60.2, -2.81, -3.38, 0.40,
  114.                                -2.8, -0.1,   -2.5, -0.11, -0.19, 0.07),

  115.         /** Transformation from ITRF 2014 To ITRF 92. */
  116.         ITRF_2014_TO_ITRF_92  (ITRFVersion.ITRF_2014, ITRFVersion.ITRF_92, 2010,
  117.                                15.4,  1.5,  -70.8, 0.00, 0.00, 0.26,
  118.                                 0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  119.         /** Transformation from ITRF 2014 To ITRF 91. */
  120.         ITRF_2014_TO_ITRF_91  (ITRFVersion.ITRF_2014, ITRFVersion.ITRF_91, 2010,
  121.                                27.4, 15.5,  -76.8, 0.00, 0.00, 0.26,
  122.                                 0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  123.         /** Transformation from ITRF 2014 To ITRF 90. */
  124.         ITRF_2014_TO_ITRF_90  (ITRFVersion.ITRF_2014, ITRFVersion.ITRF_90, 2010,
  125.                                25.4, 11.5,  -92.8, 0.00, 0.00, 0.26,
  126.                                 0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  127.         /** Transformation from ITRF 2014 To ITRF 89. */
  128.         ITRF_2014_TO_ITRF_89  (ITRFVersion.ITRF_2014, ITRFVersion.ITRF_89, 2010,
  129.                                30.4, 35.5, -130.8, 0.00, 0.00, 0.26,
  130.                                 0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  131.         /** Transformation from ITRF 2014 To ITRF 88. */
  132.         ITRF_2014_TO_ITRF_88  (ITRFVersion.ITRF_2014, ITRFVersion.ITRF_88, 2010,
  133.                                25.4, -0.5, -154.8, 0.10, 0.00, 0.26,
  134.                                 0.1, -0.5,   -3.3, 0.00, 0.00, 0.02),

  135.         // see http://itrf.ensg.ign.fr/doc_ITRF/Transfo-ITRF2008_ITRFs.txt
  136.         // SOLUTION         Tx       Ty       Tz        D        Rx        Ry        Rz      EPOCH
  137.         // UNITS----------> mm       mm       mm       ppb       .001"     .001"     .001"
  138.         //                         .        .        .         .        .         .         .
  139.         //        RATES     Tx       Ty       Tz        D        Rx        Ry        Rz
  140.         // UNITS----------> mm/y     mm/y     mm/y     ppb/y    .001"/y   .001"/y   .001"/y
  141.         // -----------------------------------------------------------------------------------------
  142.         //   ITRF2005       -2.0     -0.9     -4.7      0.94      0.00      0.00      0.00    2000.0
  143.         //        rates      0.3      0.0      0.0      0.00      0.00      0.00      0.00
  144.         //   ITRF2000       -1.9     -1.7    -10.5      1.34      0.00      0.00      0.00    2000.0
  145.         //        rates      0.1      0.1     -1.8      0.08      0.00      0.00      0.00
  146.         //   ITRF97          4.8      2.6    -33.2      2.92      0.00      0.00      0.06    2000.0
  147.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  148.         //   ITRF96          4.8      2.6    -33.2      2.92      0.00      0.00      0.06    2000.0
  149.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  150.         //   ITRF94          4.8      2.6    -33.2      2.92      0.00      0.00      0.06    2000.0
  151.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  152.         //   ITRF93        -24.0      2.4    -38.6      3.41     -1.71     -1.48     -0.30    2000.0
  153.         //        rates     -2.8     -0.1     -2.4      0.09     -0.11     -0.19      0.07
  154.         //   ITRF92         12.8      4.6    -41.2      2.21      0.00      0.00      0.06    2000.0
  155.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  156.         //   ITRF91         24.8     18.6    -47.2      3.61      0.00      0.00      0.06    2000.0
  157.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  158.         //   ITRF90         22.8     14.6    -63.2      3.91      0.00      0.00      0.06    2000.0
  159.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  160.         //   ITRF89         27.8     38.6   -101.2      7.31      0.00      0.00      0.06    2000.0
  161.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  162.         //   ITRF88         22.8      2.6   -125.2     10.41      0.10      0.00      0.06    2000.0
  163.         //        rates      0.1     -0.5     -3.2      0.09      0.00      0.00      0.02
  164.         // _________________________________________________________________________________________

  165.         /** Transformation from ITRF 2008 To ITRF 2005. */
  166.         ITRF_2008_TO_ITRF_2005(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_2005, 2000,
  167.                                -2.0, -0.9,   -4.7,  0.00,  0.00,  0.00,
  168.                                 0.3,  0.0,    0.0,  0.00,  0.00,  0.00),

  169.         /** Transformation from ITRF 2008 To ITRF 2000. */
  170.         ITRF_2008_TO_ITRF_2000(ITRFVersion.ITRF_2008, ITRFVersion.ITRF_2000, 2000,
  171.                                -1.9, -1.7,  -10.5,  0.00,  0.00,  0.00,
  172.                                 0.1,  0.1,   -1.8,  0.00,  0.00,  0.00),

  173.         /** Transformation from ITRF 2008 To ITRF 97. */
  174.         ITRF_2008_TO_ITRF_97  (ITRFVersion.ITRF_2008, ITRFVersion.ITRF_97, 2000,
  175.                                 4.8,  2.6,  -33.2,  0.00,  0.00,  0.06,
  176.                                 0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  177.         /** Transformation from ITRF 2008 To ITRF 96. */
  178.         ITRF_2008_TO_ITRF_96  (ITRFVersion.ITRF_2008, ITRFVersion.ITRF_96, 2000,
  179.                                 4.8,  2.6,  -33.2,  0.00,  0.00,  0.06,
  180.                                 0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  181.         /** Transformation from ITRF 2008 To ITRF 94. */
  182.         ITRF_2008_TO_ITRF_94  (ITRFVersion.ITRF_2008, ITRFVersion.ITRF_94, 2000,
  183.                                 4.8,  2.6,  -33.2,  0.00,  0.00,  0.06,
  184.                                 0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  185.         /** Transformation from ITRF 2008 To ITRF 93. */
  186.         ITRF_2008_TO_ITRF_93  (ITRFVersion.ITRF_2008, ITRFVersion.ITRF_93, 2000,
  187.                               -24.0,  2.4,  -38.6, -1.71, -1.48, -0.30,
  188.                                -2.8, -0.1,   -2.4, -0.11, -0.19,  0.07),

  189.         /** Transformation from ITRF 2008 To ITRF 92. */
  190.         ITRF_2008_TO_ITRF_92  (ITRFVersion.ITRF_2008, ITRFVersion.ITRF_92, 2000,
  191.                                12.8,  4.6,  -41.2,  0.00,  0.00,  0.06,
  192.                                 0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  193.         /** Transformation from ITRF 2008 To ITRF 91. */
  194.         ITRF_2008_TO_ITRF_91  (ITRFVersion.ITRF_2008, ITRFVersion.ITRF_91, 2000,
  195.                                24.8, 18.6,  -47.2,  0.00,  0.00,  0.06,
  196.                                 0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  197.         /** Transformation from ITRF 2008 To ITRF 90. */
  198.         ITRF_2008_TO_ITRF_90  (ITRFVersion.ITRF_2008, ITRFVersion.ITRF_90, 2000,
  199.                                22.8, 14.6,  -63.2,  0.00,  0.00,  0.06,
  200.                                 0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  201.         /** Transformation from ITRF 2008 To ITRF 89. */
  202.         ITRF_2008_TO_ITRF_89  (ITRFVersion.ITRF_2008, ITRFVersion.ITRF_89, 2000,
  203.                                27.8, 38.6, -101.2,  0.00,  0.00,  0.06,
  204.                                 0.1, -0.5,   -3.2,  0.00,  0.00,  0.02),

  205.         /** Transformation from ITRF 2008 To ITRF 88. */
  206.         ITRF_2008_TO_ITRF_88  (ITRFVersion.ITRF_2008, ITRFVersion.ITRF_88, 2000,
  207.                                22.8,  2.6, -125.2,  0.10,  0.00,  0.06,
  208.                                 0.1, -0.5,   -3.2,  0.00,  0.00,  0.02);

  209.         /** Origin ITRF. */
  210.         private final ITRFVersion origin;

  211.         /** Destination ITRF. */
  212.         private final ITRFVersion destination;

  213.         /** Transformation. */
  214.         private final transient HelmertTransformationWithoutTimeScale transformation;

  215.         /** Simple constructor.
  216.          * @param origin origin ITRF
  217.          * @param destination destination ITRF
  218.          * @param refYear reference year for the epoch of the transform
  219.          * @param t1 translation parameter along X axis (BEWARE, this is in mm)
  220.          * @param t2 translation parameter along Y axis (BEWARE, this is in mm)
  221.          * @param t3 translation parameter along Z axis (BEWARE, this is in mm)
  222.          * @param r1 rotation parameter around X axis (BEWARE, this is in mas)
  223.          * @param r2 rotation parameter around Y axis (BEWARE, this is in mas)
  224.          * @param r3 rotation parameter around Z axis (BEWARE, this is in mas)
  225.          * @param t1Dot rate of translation parameter along X axis (BEWARE, this is in mm/y)
  226.          * @param t2Dot rate of translation parameter along Y axis (BEWARE, this is in mm/y)
  227.          * @param t3Dot rate of translation parameter along Z axis (BEWARE, this is in mm/y)
  228.          * @param r1Dot rate of rotation parameter around X axis (BEWARE, this is in mas/y)
  229.          * @param r2Dot rate of rotation parameter around Y axis (BEWARE, this is in mas/y)
  230.          * @param r3Dot rate of rotation parameter around Z axis (BEWARE, this is in mas/y)
  231.          */
  232.         Predefined(final ITRFVersion origin, final ITRFVersion destination, final int refYear,
  233.                    final double t1, final double t2, final double t3,
  234.                    final double r1, final double r2, final double r3,
  235.                    final double t1Dot, final double t2Dot, final double t3Dot,
  236.                    final double r1Dot, final double r2Dot, final double r3Dot) {
  237.             this.origin         = origin;
  238.             this.destination    = destination;
  239.             this.transformation =
  240.                     new HelmertTransformationWithoutTimeScale(new DateTimeComponents(refYear, 1, 1, 12, 0, 0),
  241.                                               t1, t2, t3, r1, r2, r3, t1Dot, t2Dot, t3Dot, r1Dot, r2Dot, r3Dot);
  242.         }

  243.         /** Get the origin ITRF.
  244.          * @return origin ITRF
  245.          * @since 9.2
  246.          */
  247.         public ITRFVersion getOrigin() {
  248.             return origin;
  249.         }

  250.         /** Get the destination ITRF.
  251.          * @return destination ITRF
  252.          * @since 9.2
  253.          */
  254.         public ITRFVersion getDestination() {
  255.             return destination;
  256.         }

  257.         /** Get the underlying {@link HelmertTransformation}.
  258.          *
  259.          * <p>This method uses the {@link DataContext#getDefault() default data context}.
  260.          *
  261.          * @return underlying {@link HelmertTransformation}
  262.          * @since 9.2
  263.          * @see #getTransformation(TimeScale)
  264.          */
  265.         @DefaultDataContext
  266.         public HelmertTransformation getTransformation() {
  267.             return getTransformation(DataContext.getDefault().getTimeScales().getTT());
  268.         }

  269.         /** Get the underlying {@link HelmertTransformation}.
  270.          * @return underlying {@link HelmertTransformation}
  271.          * @param tt TT time scale.
  272.          * @since 10.1
  273.          */
  274.         public HelmertTransformation getTransformation(final TimeScale tt) {
  275.             return transformation.withTimeScale(tt);
  276.         }

  277.         /** Create an ITRF frame by transforming another ITRF frame.
  278.          *
  279.          * <p>This method uses the {@link DataContext#getDefault() default data context}.
  280.          *
  281.          * @param parent parent ITRF frame
  282.          * @param name name of the frame to create
  283.          * @return new ITRF frame
  284.          * @see #createTransformedITRF(Frame, String, TimeScale)
  285.          */
  286.         @DefaultDataContext
  287.         public Frame createTransformedITRF(final Frame parent, final String name) {
  288.             return createTransformedITRF(parent, name,
  289.                     DataContext.getDefault().getTimeScales().getTT());
  290.         }

  291.         /** Create an ITRF frame by transforming another ITRF frame.
  292.          * @param parent parent ITRF frame
  293.          * @param name name of the frame to create
  294.          * @param tt TT time scale.
  295.          * @return new ITRF frame
  296.          * @since 10.1
  297.          */
  298.         public Frame createTransformedITRF(final Frame parent,
  299.                                            final String name,
  300.                                            final TimeScale tt) {
  301.             return new Frame(parent, getTransformation(tt), name);
  302.         }

  303.     }

  304.     /**
  305.      * A {@link HelmertTransformation} without reference to a {@link TimeScale}. This
  306.      * class is needed to maintain compatibility with Orekit 10.0 since {@link Predefined}
  307.      * is an enum and it had a reference to the TT time scale.
  308.      */
  309.     private static class HelmertTransformationWithoutTimeScale {

  310.         /** Cartesian part of the transform. */
  311.         private final PVCoordinates cartesian;

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

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

  316.         /** Reference epoch of the transform. */
  317.         private final DateTimeComponents epoch;

  318.         /** Build a transform from its primitive operations.
  319.          * @param epoch reference epoch of the transform
  320.          * @param t1 translation parameter along X axis (BEWARE, this is in mm)
  321.          * @param t2 translation parameter along Y axis (BEWARE, this is in mm)
  322.          * @param t3 translation parameter along Z axis (BEWARE, this is in mm)
  323.          * @param r1 rotation parameter around X axis (BEWARE, this is in mas)
  324.          * @param r2 rotation parameter around Y axis (BEWARE, this is in mas)
  325.          * @param r3 rotation parameter around Z axis (BEWARE, this is in mas)
  326.          * @param t1Dot rate of translation parameter along X axis (BEWARE, this is in mm/y)
  327.          * @param t2Dot rate of translation parameter along Y axis (BEWARE, this is in mm/y)
  328.          * @param t3Dot rate of translation parameter along Z axis (BEWARE, this is in mm/y)
  329.          * @param r1Dot rate of rotation parameter around X axis (BEWARE, this is in mas/y)
  330.          * @param r2Dot rate of rotation parameter around Y axis (BEWARE, this is in mas/y)
  331.          * @param r3Dot rate of rotation parameter around Z axis (BEWARE, this is in mas/y)
  332.          */
  333.         HelmertTransformationWithoutTimeScale(
  334.                 final DateTimeComponents epoch,
  335.                 final double t1, final double t2, final double t3,
  336.                 final double r1, final double r2, final double r3,
  337.                 final double t1Dot, final double t2Dot, final double t3Dot,
  338.                 final double r1Dot, final double r2Dot, final double r3Dot) {

  339.             // conversion parameters to SI units
  340.             final double mmToM    = 1.0e-3;
  341.             final double masToRad = 1.0e-3 * Constants.ARC_SECONDS_TO_RADIANS;

  342.             this.epoch          = epoch;
  343.             this.cartesian = new PVCoordinates(new Vector3D(t1 * mmToM,
  344.                     t2 * mmToM,
  345.                     t3 * mmToM),
  346.                     new Vector3D(t1Dot * mmToM / Constants.JULIAN_YEAR,
  347.                             t2Dot * mmToM / Constants.JULIAN_YEAR,
  348.                             t3Dot * mmToM / Constants.JULIAN_YEAR));
  349.             this.rotationVector = new Vector3D(r1 * masToRad,
  350.                     r2 * masToRad,
  351.                     r3 * masToRad);
  352.             this.rotationRate   = new Vector3D(r1Dot * masToRad / Constants.JULIAN_YEAR,
  353.                     r2Dot * masToRad / Constants.JULIAN_YEAR,
  354.                     r3Dot * masToRad / Constants.JULIAN_YEAR);

  355.         }

  356.         /**
  357.          * Get the Helmert transformation with reference to the given time scale.
  358.          *
  359.          * @param tt TT time scale.
  360.          * @return Helmert transformation.
  361.          */
  362.         public HelmertTransformation withTimeScale(final TimeScale tt) {
  363.             return new HelmertTransformation(cartesian, rotationVector, rotationRate,
  364.                     new AbsoluteDate(epoch, tt));
  365.         }

  366.     }

  367.     /** Cartesian part of the transform. */
  368.     private final PVCoordinates cartesian;

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

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

  373.     /** Reference epoch of the transform. */
  374.     private final AbsoluteDate epoch;

  375.     /** Build a transform from its primitive operations.
  376.      * @param epoch reference epoch of the transform
  377.      * @param t1 translation parameter along X axis (BEWARE, this is in mm)
  378.      * @param t2 translation parameter along Y axis (BEWARE, this is in mm)
  379.      * @param t3 translation parameter along Z axis (BEWARE, this is in mm)
  380.      * @param r1 rotation parameter around X axis (BEWARE, this is in mas)
  381.      * @param r2 rotation parameter around Y axis (BEWARE, this is in mas)
  382.      * @param r3 rotation parameter around Z axis (BEWARE, this is in mas)
  383.      * @param t1Dot rate of translation parameter along X axis (BEWARE, this is in mm/y)
  384.      * @param t2Dot rate of translation parameter along Y axis (BEWARE, this is in mm/y)
  385.      * @param t3Dot rate of translation parameter along Z axis (BEWARE, this is in mm/y)
  386.      * @param r1Dot rate of rotation parameter around X axis (BEWARE, this is in mas/y)
  387.      * @param r2Dot rate of rotation parameter around Y axis (BEWARE, this is in mas/y)
  388.      * @param r3Dot rate of rotation parameter around Z axis (BEWARE, this is in mas/y)
  389.      */
  390.     public HelmertTransformation(final AbsoluteDate epoch,
  391.                                  final double t1, final double t2, final double t3,
  392.                                  final double r1, final double r2, final double r3,
  393.                                  final double t1Dot, final double t2Dot, final double t3Dot,
  394.                                  final double r1Dot, final double r2Dot, final double r3Dot) {

  395.         // conversion parameters to SI units
  396.         final double mmToM    = 1.0e-3;
  397.         final double masToRad = 1.0e-3 * Constants.ARC_SECONDS_TO_RADIANS;

  398.         this.epoch          = epoch;
  399.         this.cartesian = new PVCoordinates(new Vector3D(t1 * mmToM,
  400.                                                         t2 * mmToM,
  401.                                                         t3 * mmToM),
  402.                                            new Vector3D(t1Dot * mmToM / Constants.JULIAN_YEAR,
  403.                                                         t2Dot * mmToM / Constants.JULIAN_YEAR,
  404.                                                         t3Dot * mmToM / Constants.JULIAN_YEAR));
  405.         this.rotationVector = new Vector3D(r1 * masToRad,
  406.                                            r2 * masToRad,
  407.                                            r3 * masToRad);
  408.         this.rotationRate   = new Vector3D(r1Dot * masToRad / Constants.JULIAN_YEAR,
  409.                                            r2Dot * masToRad / Constants.JULIAN_YEAR,
  410.                                            r3Dot * masToRad / Constants.JULIAN_YEAR);

  411.     }

  412.     /**
  413.      * Private constructor.
  414.      *
  415.      * @param cartesian      part of the transform.
  416.      * @param rotationVector global rotation vector.
  417.      * @param rotationRate   time derivative of rotation.
  418.      * @param epoch          of transform.
  419.      */
  420.     private HelmertTransformation(final PVCoordinates cartesian,
  421.                                   final Vector3D rotationVector,
  422.                                   final Vector3D rotationRate,
  423.                                   final AbsoluteDate epoch) {
  424.         this.cartesian = cartesian;
  425.         this.rotationVector = rotationVector;
  426.         this.rotationRate = rotationRate;
  427.         this.epoch = epoch;
  428.     }

  429.     /** Get the reference epoch of the transform.
  430.      * @return reference epoch of the transform
  431.      */
  432.     public AbsoluteDate getEpoch() {
  433.         return epoch;
  434.     }

  435.     /** {@inheritDoc} */
  436.     @Override
  437.     public Transform getTransform(final AbsoluteDate date) {

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

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

  443.         // build rotation part
  444.         final double angle = dR.getNorm();
  445.         final Transform rotationTransform =
  446.                 new Transform(date,
  447.                               (angle < Precision.SAFE_MIN) ?
  448.                               Rotation.IDENTITY :
  449.                               new Rotation(dR, angle, RotationConvention.VECTOR_OPERATOR),
  450.                               rotationRate);

  451.         // combine both parts
  452.         return new Transform(date, translationTransform, rotationTransform);

  453.     }

  454.     /** {@inheritDoc} */
  455.     @Override
  456.     public <T extends RealFieldElement<T>> FieldTransform<T> getTransform(final FieldAbsoluteDate<T> date) {

  457.         // compute parameters evolution since reference epoch
  458.         final T dt = date.durationFrom(epoch);
  459.         final FieldVector3D<T> dR = new FieldVector3D<>(date.getField().getOne(), rotationVector,
  460.                                                         dt, rotationRate);

  461.         // build translation part
  462.         final FieldTransform<T> translationTransform =
  463.                         new FieldTransform<>(date,
  464.                                              new FieldPVCoordinates<>(date.getField(), cartesian).shiftedBy(dt));

  465.         // build rotation part
  466.         final T angle = dR.getNorm();
  467.         final FieldTransform<T> rotationTransform =
  468.                 new FieldTransform<>(date,
  469.                                     (angle.getReal() < Precision.SAFE_MIN) ?
  470.                                      FieldRotation.getIdentity(date.getField()) :
  471.                                     new FieldRotation<>(dR, angle, RotationConvention.VECTOR_OPERATOR),
  472.                                     new FieldVector3D<>(date.getField(), rotationRate));

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

  475.     }

  476. }