use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.
the class FieldTransformTest method doTestTranslation.
private <T extends RealFieldElement<T>> void doTestTranslation(Field<T> field) {
RandomGenerator rnd = new Well19937a(0x7e9d737ba4147787l);
for (int i = 0; i < 10; ++i) {
FieldVector3D<T> delta = randomVector(field, 1.0e3, rnd);
FieldTransform<T> transform = new FieldTransform<>(FieldAbsoluteDate.getJ2000Epoch(field), delta);
for (int j = 0; j < 10; ++j) {
FieldVector3D<T> a = createVector(field, rnd.nextDouble(), rnd.nextDouble(), rnd.nextDouble());
FieldVector3D<T> b = transform.transformVector(a);
Assert.assertEquals(0, b.subtract(a).getNorm().getReal(), 1.0e-15);
FieldVector3D<T> c = transform.transformPosition(a);
Assert.assertEquals(0, c.subtract(a).subtract(delta).getNorm().getReal(), 1.0e-14);
}
}
}
use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.
the class FieldTransformTest method doTestRotation.
private <T extends RealFieldElement<T>> void doTestRotation(Field<T> field) {
RandomGenerator rnd = new Well19937a(0x73d5554d99427af0l);
for (int i = 0; i < 10; ++i) {
FieldRotation<T> r = randomRotation(field, rnd);
FieldVector3D<T> axis = r.getAxis(RotationConvention.VECTOR_OPERATOR);
T angle = r.getAngle();
FieldTransform<T> transform = new FieldTransform<>(FieldAbsoluteDate.getJ2000Epoch(field), r);
for (int j = 0; j < 10; ++j) {
FieldVector3D<T> a = createVector(field, rnd.nextDouble(), rnd.nextDouble(), rnd.nextDouble());
FieldVector3D<T> b = transform.transformVector(a);
Assert.assertEquals(FieldVector3D.angle(axis, a).getReal(), FieldVector3D.angle(axis, b).getReal(), 1.0e-14);
FieldVector3D<T> aOrtho = FieldVector3D.crossProduct(axis, a);
FieldVector3D<T> bOrtho = FieldVector3D.crossProduct(axis, b);
Assert.assertEquals(angle.getReal(), FieldVector3D.angle(aOrtho, bOrtho).getReal(), 1.0e-14);
FieldVector3D<T> c = transform.transformPosition(a);
Assert.assertEquals(0, c.subtract(b).getNorm().getReal(), 1.0e-14);
}
}
}
use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.
the class FieldTransformTest method doTestReverse.
private <T extends RealFieldElement<T>> void doTestReverse(Field<T> field) {
RandomGenerator random = new Well19937a(0x9f82ba2b2c98dac5l);
for (int i = 0; i < 20; ++i) {
FieldTransform<T> combined = randomTransform(field, random);
checkNoTransform(new FieldTransform<>(FieldAbsoluteDate.getJ2000Epoch(field), combined, combined.getInverse()), random);
}
}
use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.
the class TransformProviderUtilTest method testIdentity.
@Test
public void testIdentity() throws OrekitException {
RandomGenerator random = new Well19937a(0x87c3a5c51fb0235el);
final AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
checkNoTransform(TransformProviderUtils.IDENTITY_PROVIDER.getTransform(date), random);
}
use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.
the class TransformProviderUtilTest method testReverseField.
@Test
public void testReverseField() throws OrekitException {
RandomGenerator random = new Well19937a(0xd74443b3079403e7l);
final FieldAbsoluteDate<Decimal64> date = new FieldAbsoluteDate<>(Decimal64Field.getInstance(), AbsoluteDate.J2000_EPOCH);
for (int i = 0; i < 20; ++i) {
TransformProvider tp = constantProvider(random);
TransformProvider reversed = TransformProviderUtils.getReversedProvider(tp);
checkNoTransform(new FieldTransform<>(date, tp.getTransform(date), reversed.getTransform(date)), random);
checkNoTransform(new FieldTransform<>(date, reversed.getTransform(date), tp.getTransform(date)), random);
}
}
Aggregations