Search in sources :

Example 66 with Well19937a

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);
        }
    }
}
Also used : Well19937a(org.hipparchus.random.Well19937a) RandomGenerator(org.hipparchus.random.RandomGenerator)

Example 67 with Well19937a

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);
        }
    }
}
Also used : Well19937a(org.hipparchus.random.Well19937a) RandomGenerator(org.hipparchus.random.RandomGenerator)

Example 68 with Well19937a

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);
    }
}
Also used : Well19937a(org.hipparchus.random.Well19937a) RandomGenerator(org.hipparchus.random.RandomGenerator)

Example 69 with Well19937a

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);
}
Also used : Well19937a(org.hipparchus.random.Well19937a) RandomGenerator(org.hipparchus.random.RandomGenerator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 70 with Well19937a

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);
    }
}
Also used : Decimal64(org.hipparchus.util.Decimal64) Well19937a(org.hipparchus.random.Well19937a) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) RandomGenerator(org.hipparchus.random.RandomGenerator) Test(org.junit.Test)

Aggregations

RandomGenerator (org.hipparchus.random.RandomGenerator)73 Well19937a (org.hipparchus.random.Well19937a)73 Test (org.junit.Test)51 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)22 GeodeticPoint (org.orekit.bodies.GeodeticPoint)19 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)17 PVCoordinates (org.orekit.utils.PVCoordinates)15 TimeStampedFieldPVCoordinates (org.orekit.utils.TimeStampedFieldPVCoordinates)15 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)14 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)14 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)13 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)13 Frame (org.orekit.frames.Frame)10 GaussianRandomGenerator (org.hipparchus.random.GaussianRandomGenerator)8 UncorrelatedRandomVectorGenerator (org.hipparchus.random.UncorrelatedRandomVectorGenerator)8 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)8 OrbitType (org.orekit.orbits.OrbitType)8 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)8 SpacecraftState (org.orekit.propagation.SpacecraftState)8 FieldNumericalPropagator (org.orekit.propagation.numerical.FieldNumericalPropagator)8