use of org.hipparchus.random.Well1024a in project Orekit by CS-SI.
the class FieldAngularCoordinatesTest method testRodriguesSymmetry.
@Test
public void testRodriguesSymmetry() {
// check the two-way conversion result in identity
RandomGenerator random = new Well1024a(0xb1e615aaa8236b52l);
for (int i = 0; i < 1000; ++i) {
FieldRotation<DerivativeStructure> rotation = randomRotation(random);
FieldVector3D<DerivativeStructure> rotationRate = randomVector(random, 0.01);
FieldVector3D<DerivativeStructure> rotationAcceleration = randomVector(random, 0.01);
FieldAngularCoordinates<DerivativeStructure> ac = new FieldAngularCoordinates<>(rotation, rotationRate, rotationAcceleration);
FieldAngularCoordinates<DerivativeStructure> rebuilt = FieldAngularCoordinates.createFromModifiedRodrigues(ac.getModifiedRodrigues(1.0));
Assert.assertEquals(0.0, FieldRotation.distance(rotation, rebuilt.getRotation()).getReal(), 1.0e-14);
Assert.assertEquals(0.0, FieldVector3D.distance(rotationRate, rebuilt.getRotationRate()).getReal(), 1.0e-15);
Assert.assertEquals(0.0, FieldVector3D.distance(rotationAcceleration, rebuilt.getRotationAcceleration()).getReal(), 1.0e-15);
}
}
use of org.hipparchus.random.Well1024a in project Orekit by CS-SI.
the class FieldAngularCoordinatesTest method testRandomPVCoordinates.
@Test
public void testRandomPVCoordinates() throws OrekitException {
RandomGenerator generator = new Well1024a(0xf978035a328a565bl);
for (int i = 0; i < 100; ++i) {
FieldRotation<DerivativeStructure> r = randomRotation(generator);
FieldVector3D<DerivativeStructure> omega = randomVector(generator, 10 * generator.nextDouble() + 1.0);
FieldVector3D<DerivativeStructure> omegaDot = randomVector(generator, 0.1 * generator.nextDouble() + 0.01);
FieldAngularCoordinates<DerivativeStructure> ref = new FieldAngularCoordinates<>(r, omega, omegaDot);
FieldAngularCoordinates<DerivativeStructure> inv = ref.revert();
for (int j = 0; j < 100; ++j) {
FieldPVCoordinates<DerivativeStructure> v1 = randomPVCoordinates(generator, 1000, 1.0, 0.001);
FieldPVCoordinates<DerivativeStructure> v2 = randomPVCoordinates(generator, 1000, 1.0, 0.0010);
FieldPVCoordinates<DerivativeStructure> u1 = inv.applyTo(v1);
FieldPVCoordinates<DerivativeStructure> u2 = inv.applyTo(v2);
FieldAngularCoordinates<DerivativeStructure> rebuilt = new FieldAngularCoordinates<>(u1, u2, v1, v2, 1.0e-9);
Assert.assertEquals(0.0, FieldRotation.distance(r, rebuilt.getRotation()).getReal(), 6.0e-14);
Assert.assertEquals(0.0, FieldVector3D.distance(omega, rebuilt.getRotationRate()).getReal(), 3.0e-12 * omega.getNorm().getReal());
Assert.assertEquals(0.0, FieldVector3D.distance(omegaDot, rebuilt.getRotationAcceleration()).getReal(), 2.0e-6 * omegaDot.getNorm().getReal());
}
}
}
use of org.hipparchus.random.Well1024a 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.random.Well1024a 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.random.Well1024a in project Orekit by CS-SI.
the class AngularCoordinatesTest method testRodriguesSpecialCases.
@Test
public void testRodriguesSpecialCases() {
// identity
double[][] identity = new AngularCoordinates(Rotation.IDENTITY, Vector3D.ZERO, Vector3D.ZERO).getModifiedRodrigues(1.0);
for (double[] row : identity) {
for (double element : row) {
Assert.assertEquals(0.0, element, Precision.SAFE_MIN);
}
}
AngularCoordinates acId = AngularCoordinates.createFromModifiedRodrigues(identity);
Assert.assertEquals(0.0, acId.getRotation().getAngle(), Precision.SAFE_MIN);
Assert.assertEquals(0.0, acId.getRotationRate().getNorm(), Precision.SAFE_MIN);
// PI angle rotation (which is singular for non-modified Rodrigues vector)
RandomGenerator random = new Well1024a(0x2158523e6accb859l);
for (int i = 0; i < 100; ++i) {
Vector3D axis = randomVector(random, 1.0);
AngularCoordinates original = new AngularCoordinates(new Rotation(axis, FastMath.PI, RotationConvention.VECTOR_OPERATOR), Vector3D.ZERO, Vector3D.ZERO);
AngularCoordinates rebuilt = AngularCoordinates.createFromModifiedRodrigues(original.getModifiedRodrigues(1.0));
Assert.assertEquals(FastMath.PI, rebuilt.getRotation().getAngle(), 1.0e-15);
Assert.assertEquals(0.0, FastMath.sin(Vector3D.angle(axis, rebuilt.getRotation().getAxis(RotationConvention.VECTOR_OPERATOR))), 1.0e-15);
Assert.assertEquals(0.0, rebuilt.getRotationRate().getNorm(), 1.0e-16);
}
}
Aggregations