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.Test;
26  import org.orekit.frames.Frame;
27  import org.orekit.frames.FramesFactory;
28  import org.orekit.time.FieldAbsoluteDate;
29  
30  public class ExtendedPVCoordinatesTest {
31  
32      @Test
33      @Deprecated
34      public void testConversion() {
35          final ExtendedPositionProvider provider = new ExtendedPositionProvider() {
36  
37              @Override
38              public <T extends CalculusFieldElement<T>> FieldVector3D<T> getPosition(FieldAbsoluteDate<T> date, Frame frame) {
39                  return FieldVector3D.getPlusI(date.getField());
40              }
41          }.toExtendedPVCoordinatesProvider();
42  
43          Field<Binary64> field = Binary64Field.getInstance();
44          final FieldPVCoordinatesProvider<Binary64> converted = provider.toFieldPVCoordinatesProvider(field);
45          final FieldAbsoluteDate<Binary64> date = FieldAbsoluteDate.getJ2000Epoch(field);
46          final Frame frame = FramesFactory.getGCRF();
47          FieldVector3D<Binary64> p = converted.getPosition(date, frame);
48          Assertions.assertEquals(0.0, FieldVector3D.distance(p, FieldVector3D.getPlusI(field)).getReal(), 1.0e-15);
49  
50          FieldPVCoordinates<Binary64> pv = converted.getPVCoordinates(date, frame);
51          Assertions.assertEquals(0.0, FieldVector3D.distance(pv.getPosition(),     FieldVector3D.getPlusI(field)).getReal(), 1.0e-15);
52          Assertions.assertEquals(0.0, FieldVector3D.distance(pv.getVelocity(),     provider.getPVCoordinates(date, frame).getVelocity()).getReal(), 1.0e-15);
53          Assertions.assertEquals(0.0, FieldVector3D.distance(pv.getAcceleration(), provider.getPVCoordinates(date, frame).getAcceleration()).getReal(), 1.0e-15);
54  
55      }
56  
57  }