Commit 26d003b1 authored by Bryan Cazabonne's avatar Bryan Cazabonne

Merge branch 'issue-773' into 'develop'

TimeStampedFieldAngularCoordinates now implements FieldTimeStamped.

Closes #773

See merge request !155
parents cc4ef9ea c3f83bf8
Pipeline #1033 passed with stages
in 31 minutes and 18 seconds
......@@ -21,6 +21,9 @@
</properties>
<body>
<release version="11.0" date="TBD" description="TBD">
<action dev="bryan" type="update" issue="773">
TimeStampedFieldAngularCoordinates now implements FieldTimeStamped.
</action>
<action dev="bryan" type="update" issue="774">
TimeStampedFieldPVCoordinates now implements FieldTimeStamped.
</action>
......
......@@ -32,6 +32,7 @@ import org.orekit.errors.OrekitInternalError;
import org.orekit.errors.OrekitMessages;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.FieldAbsoluteDate;
import org.orekit.time.FieldTimeStamped;
import org.orekit.time.TimeStamped;
/** {@link TimeStamped time-stamped} version of {@link FieldAngularCoordinates}.
......@@ -41,7 +42,7 @@ import org.orekit.time.TimeStamped;
* @since 7.0
*/
public class TimeStampedFieldAngularCoordinates<T extends RealFieldElement<T>>
extends FieldAngularCoordinates<T> {
extends FieldAngularCoordinates<T> implements FieldTimeStamped<T> {
/** The date. */
private final FieldAbsoluteDate<T> date;
......@@ -179,9 +180,8 @@ public class TimeStampedFieldAngularCoordinates<T extends RealFieldElement<T>>
getRotation().applyInverseTo(getRotationAcceleration().negate()));
}
/** Get the date.
* @return date
*/
/** {@inheritDoc} */
@Override
public FieldAbsoluteDate<T> getDate() {
return date;
}
......
......@@ -21,6 +21,8 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import org.hipparchus.Field;
import org.hipparchus.RealFieldElement;
import org.hipparchus.analysis.differentiation.DSFactory;
import org.hipparchus.analysis.differentiation.DerivativeStructure;
import org.hipparchus.analysis.differentiation.FieldDerivativeStructure;
......@@ -30,6 +32,7 @@ import org.hipparchus.geometry.euclidean.threed.FieldRotation;
import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
import org.hipparchus.geometry.euclidean.threed.Rotation;
import org.hipparchus.geometry.euclidean.threed.RotationConvention;
import org.hipparchus.geometry.euclidean.threed.Vector3D;
import org.hipparchus.random.RandomGenerator;
import org.hipparchus.random.Well1024a;
import org.hipparchus.util.Decimal64;
......@@ -41,6 +44,7 @@ import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
import org.orekit.time.AbsoluteDate;
import org.orekit.time.FieldAbsoluteDate;
import org.orekit.time.FieldTimeStamped;
import org.orekit.time.TimeScalesFactory;
public class TimeStampedFieldAngularCoordinatesTest {
......@@ -487,6 +491,30 @@ public class TimeStampedFieldAngularCoordinatesTest {
}
@Test
public void testIssue773() {
doTestIssue773(Decimal64Field.getInstance());
}
private <T extends RealFieldElement<T>> void doTestIssue773(final Field<T> field) {
// Epoch
final AbsoluteDate date = new AbsoluteDate();
// Coordinates
final TimeStampedAngularCoordinates angular =
new TimeStampedAngularCoordinates(date,
new Rotation(0., 0., 0., 0., false),
Vector3D.ZERO,
Vector3D.ZERO);
// Time stamped object
final FieldTimeStamped<T> timeStamped =
new TimeStampedFieldAngularCoordinates<>(field, angular);
// Verify
Assert.assertEquals(0.0, date.durationFrom(timeStamped.getDate().toAbsoluteDate()), Double.MIN_VALUE);
}
private FieldVector3D<DerivativeStructure> randomVector(Random random, double norm) {
double n = random.nextDouble() * norm;
double x = random.nextDouble();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment