use of org.hipparchus.geometry.euclidean.threed.Vector3D 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.Vector3D 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.Vector3D in project Orekit by CS-SI.
the class TimeStampedAngularCoordinatesTest method testShift.
@Test
public void testShift() throws OrekitException {
double rate = 2 * FastMath.PI / (12 * 60);
TimeStampedAngularCoordinates ac = new TimeStampedAngularCoordinates(AbsoluteDate.J2000_EPOCH, Rotation.IDENTITY, new Vector3D(rate, Vector3D.PLUS_K), Vector3D.ZERO);
Assert.assertEquals(rate, ac.getRotationRate().getNorm(), 1.0e-10);
double dt = 10.0;
double alpha = rate * dt;
TimeStampedAngularCoordinates shifted = ac.shiftedBy(dt);
Assert.assertEquals(rate, shifted.getRotationRate().getNorm(), 1.0e-10);
Assert.assertEquals(alpha, Rotation.distance(ac.getRotation(), shifted.getRotation()), 1.0e-10);
Vector3D xSat = shifted.getRotation().applyInverseTo(Vector3D.PLUS_I);
Assert.assertEquals(0.0, xSat.subtract(new Vector3D(FastMath.cos(alpha), FastMath.sin(alpha), 0)).getNorm(), 1.0e-10);
Vector3D ySat = shifted.getRotation().applyInverseTo(Vector3D.PLUS_J);
Assert.assertEquals(0.0, ySat.subtract(new Vector3D(-FastMath.sin(alpha), FastMath.cos(alpha), 0)).getNorm(), 1.0e-10);
Vector3D zSat = shifted.getRotation().applyInverseTo(Vector3D.PLUS_K);
Assert.assertEquals(0.0, zSat.subtract(Vector3D.PLUS_K).getNorm(), 1.0e-10);
}
use of org.hipparchus.geometry.euclidean.threed.Vector3D 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);
}
}
use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.
the class TimeStampedAngularCoordinatesTest method testInterpolationWithoutAcceleration.
@Test
public void testInterpolationWithoutAcceleration() throws OrekitException {
AbsoluteDate date = AbsoluteDate.GALILEO_EPOCH;
double alpha0 = 0.5 * FastMath.PI;
double omega = 0.05 * FastMath.PI;
final TimeStampedAngularCoordinates reference = new TimeStampedAngularCoordinates(date, new Rotation(Vector3D.PLUS_K, alpha0, RotationConvention.VECTOR_OPERATOR), new Vector3D(omega, Vector3D.MINUS_K), Vector3D.ZERO);
double[] errors = interpolationErrors(reference, 1.0);
Assert.assertEquals(0.0, errors[0], 1.4e-15);
Assert.assertEquals(0.0, errors[1], 3.0e-15);
Assert.assertEquals(0.0, errors[2], 3.0e-14);
}
Aggregations