Commit 750825d8 authored by Evan Ward's avatar Evan Ward
Browse files

Improve test coverage for #903

parent e2475b89
......@@ -137,7 +137,7 @@ public class Transform implements
*/
public Transform(final AbsoluteDate date, final Vector3D translation) {
this(date,
new PVCoordinates(translation, Vector3D.ZERO, Vector3D.ZERO),
new PVCoordinates(translation),
AngularCoordinates.IDENTITY);
}
......@@ -150,7 +150,7 @@ public class Transform implements
public Transform(final AbsoluteDate date, final Rotation rotation) {
this(date,
PVCoordinates.ZERO,
new AngularCoordinates(rotation, Vector3D.ZERO));
new AngularCoordinates(rotation));
}
/** Build a translation transform, with its first time derivative.
......
......@@ -23,6 +23,7 @@ import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import org.hamcrest.MatcherAssert;
import org.hipparchus.CalculusFieldElement;
import org.hipparchus.geometry.euclidean.threed.FieldRotation;
import org.hipparchus.geometry.euclidean.threed.FieldVector3D;
......@@ -35,6 +36,7 @@ import org.hipparchus.util.FastMath;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.orekit.OrekitMatchers;
import org.orekit.Utils;
import org.orekit.data.DataContext;
import org.orekit.time.AbsoluteDate;
......@@ -94,6 +96,14 @@ public class GTODProviderTest {
Transform t = FramesFactory.getTOD(IERSConventions.IERS_1996, true).
getTransformTo(FramesFactory.getGTOD(IERSConventions.IERS_1996, true), t0);
checkPV(fix.transformPVCoordinates(pvPEF), t.transformPVCoordinates(pvTOD), 0.00942, 3.12e-5);
StaticTransform st = FramesFactory.getTOD(IERSConventions.IERS_1996, true).
getStaticTransformTo(FramesFactory.getGTOD(IERSConventions.IERS_1996, true), t0);
MatcherAssert.assertThat(
st.getTranslation(),
OrekitMatchers.vectorCloseTo(t.getTranslation(), 0));
MatcherAssert.assertThat(
Rotation.distance(st.getRotation(), t.getRotation()),
OrekitMatchers.closeTo(0, 0));
// if we forget to apply nutation corrections, results are much worse, which is expected
t = FramesFactory.getTOD(false).getTransformTo(FramesFactory.getGTOD(false), t0);
......
......@@ -17,11 +17,14 @@
package org.orekit.frames;
import org.hamcrest.MatcherAssert;
import org.hipparchus.geometry.euclidean.threed.Rotation;
import org.hipparchus.util.Decimal64;
import org.hipparchus.util.Decimal64Field;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.orekit.OrekitMatchers;
import org.orekit.Utils;
import org.orekit.errors.OrekitException;
import org.orekit.errors.OrekitMessages;
......@@ -175,6 +178,10 @@ public class ITRFVersionTest {
new Transform(date,
converter.getTransform(date),
destinationFrame.getTransformTo(originFrame, date));
StaticTransform sLooped = StaticTransform.compose(
date,
converter.getStaticTransform(date),
destinationFrame.getStaticTransformTo(originFrame, date));
if (origin == ITRFVersion.ITRF_2008 || destination == ITRFVersion.ITRF_2008) {
// if we use ITRF 2008, as internally the pivot frame is ITRF 2014
// on side of the transform is computed as f -> 2008 -> 2014, and on
......@@ -197,6 +204,12 @@ public class ITRFVersionTest {
Assert.assertEquals(0, looped.getRotation().getAngle(), 1.0e-40);
Assert.assertEquals(0, looped.getRotationRate().getNorm(), 2.0e-32);
}
MatcherAssert.assertThat(
sLooped.getTranslation(),
OrekitMatchers.vectorCloseTo(looped.getTranslation(), 0));
MatcherAssert.assertThat(
Rotation.distance(sLooped.getRotation(), looped.getRotation()),
OrekitMatchers.closeTo(0, 0));
FieldAbsoluteDate<Decimal64> date64 = new FieldAbsoluteDate<>(Decimal64Field.getInstance(), date);
FieldTransform<Decimal64> looped64 =
......
Supports Markdown
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