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.utils;
18  
19  import org.hipparchus.CalculusFieldElement;
20  import org.hipparchus.Field;
21  import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
22  import org.hipparchus.util.Binary64;
23  import org.hipparchus.util.Binary64Field;
24  import org.junit.jupiter.api.Assertions;
25  import org.junit.jupiter.api.BeforeEach;
26  import org.junit.jupiter.api.Test;
27  import org.orekit.Utils;
28  import org.orekit.frames.Frame;
29  import org.orekit.frames.FramesFactory;
30  import org.orekit.time.FieldAbsoluteDate;
31  
32  public class ExtendedPVCoordinatesTest {
33  
34      @Test
35      @Deprecated
36      public void testConversion() {
37          final ExtendedPositionProvider provider = new ExtendedPositionProvider() {
38  
39              @Override
40              public <T extends CalculusFieldElement<T>> FieldVector3D<T> getPosition(FieldAbsoluteDate<T> date, Frame frame) {
41                  return FieldVector3D.getPlusI(date.getField());
42              }
43          }.toExtendedPVCoordinatesProvider();
44  
45          Field<Binary64> field = Binary64Field.getInstance();
46          final FieldPVCoordinatesProvider<Binary64> converted = provider.toFieldPVCoordinatesProvider(field);
47          final FieldAbsoluteDate<Binary64> date = FieldAbsoluteDate.getJ2000Epoch(field);
48          final Frame frame = FramesFactory.getGCRF();
49          FieldVector3D<Binary64> p = converted.getPosition(date, frame);
50          Assertions.assertEquals(0.0, FieldVector3D.distance(p, FieldVector3D.getPlusI(field)).getReal(), 1.0e-15);
51  
52          FieldPVCoordinates<Binary64> pv = converted.getPVCoordinates(date, frame);
53          Assertions.assertEquals(0.0, FieldVector3D.distance(pv.getPosition(),     FieldVector3D.getPlusI(field)).getReal(), 1.0e-15);
54          Assertions.assertEquals(0.0, FieldVector3D.distance(pv.getVelocity(),     provider.getPVCoordinates(date, frame).getVelocity()).getReal(), 1.0e-15);
55          Assertions.assertEquals(0.0, FieldVector3D.distance(pv.getAcceleration(), provider.getPVCoordinates(date, frame).getAcceleration()).getReal(), 1.0e-15);
56  
57      }
58  
59      @BeforeEach
60      public void setUp() {
61          Utils.setDataRoot("regular-data");
62      }
63  
64  }