use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.
the class FieldAngularCoordinatesTest method testConversionConstructor.
@Test
public void testConversionConstructor() {
AngularCoordinates ac = new AngularCoordinates(new Rotation(Vector3D.MINUS_J, 0.15, RotationConvention.VECTOR_OPERATOR), new Vector3D(0.001, 0.002, 0.003), new Vector3D(-1.0e-6, -3.0e-6, 7.0e-6));
FieldAngularCoordinates<Decimal64> ac64 = new FieldAngularCoordinates<>(Decimal64Field.getInstance(), ac);
Assert.assertEquals(0.0, Rotation.distance(ac.getRotation(), ac64.getRotation().toRotation()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(ac.getRotationRate(), ac64.getRotationRate().toVector3D()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(ac.getRotationAcceleration(), ac64.getRotationAcceleration().toVector3D()), 1.0e-15);
}
use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.
the class TimeStampedAngularCoordinatesTest method testDerivativesStructures2.
@Test
public void testDerivativesStructures2() throws OrekitException {
RandomGenerator random = new Well1024a(0x75fbebbdbf127b3dl);
Rotation r = randomRotation(random);
Vector3D o = randomVector(random, 1.0e-2);
Vector3D oDot = randomVector(random, 1.0e-2);
TimeStampedAngularCoordinates ac = new TimeStampedAngularCoordinates(AbsoluteDate.J2000_EPOCH, r, o, oDot);
TimeStampedAngularCoordinates rebuilt = new TimeStampedAngularCoordinates(AbsoluteDate.J2000_EPOCH, ac.toDerivativeStructureRotation(2));
Assert.assertEquals(0.0, Rotation.distance(ac.getRotation(), rebuilt.getRotation()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(ac.getRotationRate(), rebuilt.getRotationRate()), 1.0e-15);
Assert.assertEquals(0.0, Vector3D.distance(ac.getRotationAcceleration(), rebuilt.getRotationAcceleration()), 1.0e-15);
}
use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.
the class TimeStampedAngularCoordinatesTest method testInterpolationRotationOnly.
@Test
public void testInterpolationRotationOnly() throws OrekitException {
AbsoluteDate date = AbsoluteDate.GALILEO_EPOCH;
double alpha0 = 0.5 * FastMath.PI;
double omega = 0.5 * FastMath.PI;
TimeStampedAngularCoordinates reference = new TimeStampedAngularCoordinates(date, new Rotation(Vector3D.PLUS_K, alpha0, RotationConvention.VECTOR_OPERATOR), new Vector3D(omega, Vector3D.MINUS_K), Vector3D.ZERO);
List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>();
for (double dt : new double[] { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }) {
Rotation r = reference.shiftedBy(dt).getRotation();
sample.add(new TimeStampedAngularCoordinates(date.shiftedBy(dt), r, Vector3D.ZERO, Vector3D.ZERO));
}
for (double dt = 0; dt < 1.0; dt += 0.001) {
TimeStampedAngularCoordinates interpolated = TimeStampedAngularCoordinates.interpolate(date.shiftedBy(dt), AngularDerivativesFilter.USE_R, sample);
Rotation r = interpolated.getRotation();
Vector3D rate = interpolated.getRotationRate();
Assert.assertEquals(0.0, Rotation.distance(reference.shiftedBy(dt).getRotation(), r), 3.0e-4);
Assert.assertEquals(0.0, Vector3D.distance(reference.shiftedBy(dt).getRotationRate(), rate), 1.0e-2);
}
}
use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.
the class TimeStampedAngularCoordinatesTest method testZeroRate.
@Test
public void testZeroRate() throws OrekitException {
TimeStampedAngularCoordinates ac = new TimeStampedAngularCoordinates(AbsoluteDate.J2000_EPOCH, new Rotation(0.48, 0.64, 0.36, 0.48, false), Vector3D.ZERO, Vector3D.ZERO);
Assert.assertEquals(Vector3D.ZERO, ac.getRotationRate());
double dt = 10.0;
TimeStampedAngularCoordinates shifted = ac.shiftedBy(dt);
Assert.assertEquals(Vector3D.ZERO, shifted.getRotationAcceleration());
Assert.assertEquals(Vector3D.ZERO, shifted.getRotationRate());
Assert.assertEquals(0.0, Rotation.distance(ac.getRotation(), shifted.getRotation()), 1.0e-15);
}
use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.
the class TimeStampedAngularCoordinatesTest method testRoundTripNoOp.
@Test
public void testRoundTripNoOp() {
RandomGenerator random = new Well1024a(0x1e610cfe89306669l);
for (int i = 0; i < 100; ++i) {
Rotation r1 = randomRotation(random);
Vector3D o1 = randomVector(random, 1.0e-2);
Vector3D a1 = randomVector(random, 1.0e-2);
TimeStampedAngularCoordinates ac1 = new TimeStampedAngularCoordinates(AbsoluteDate.J2000_EPOCH, r1, o1, a1);
Rotation r2 = randomRotation(random);
Vector3D o2 = randomVector(random, 1.0e-2);
Vector3D a2 = randomVector(random, 1.0e-2);
TimeStampedAngularCoordinates ac2 = new TimeStampedAngularCoordinates(AbsoluteDate.J2000_EPOCH, r2, o2, a2);
TimeStampedAngularCoordinates roundTripSA = ac1.subtractOffset(ac2).addOffset(ac2);
Assert.assertEquals(0.0, Rotation.distance(ac1.getRotation(), roundTripSA.getRotation()), 4.0e-16);
Assert.assertEquals(0.0, Vector3D.distance(ac1.getRotationRate(), roundTripSA.getRotationRate()), 2.0e-17);
Assert.assertEquals(0.0, Vector3D.distance(ac1.getRotationAcceleration(), roundTripSA.getRotationAcceleration()), 1.0e-17);
TimeStampedAngularCoordinates roundTripAS = ac1.addOffset(ac2).subtractOffset(ac2);
Assert.assertEquals(0.0, Rotation.distance(ac1.getRotation(), roundTripAS.getRotation()), 6.0e-16);
Assert.assertEquals(0.0, Vector3D.distance(ac1.getRotationRate(), roundTripAS.getRotationRate()), 2.0e-17);
Assert.assertEquals(0.0, Vector3D.distance(ac1.getRotationAcceleration(), roundTripAS.getRotationAcceleration()), 2.0e-17);
}
}
Aggregations