Search in sources :

Example 41 with FieldPVCoordinates

use of org.orekit.utils.FieldPVCoordinates in project Orekit by CS-SI.

the class FieldTransformTest method doTestTransPVDouble.

private <T extends RealFieldElement<T>> void doTestTransPVDouble(Field<T> field) {
    RandomGenerator rnd = new Well19937a(0x73d5554d99427af0l);
    for (int i = 0; i < 10; ++i) {
        // random position, velocity and acceleration
        Vector3D pos = randomVector(field, 1.0e3, rnd).toVector3D();
        Vector3D vel = randomVector(field, 1.0, rnd).toVector3D();
        Vector3D acc = randomVector(field, 1.0e-3, rnd).toVector3D();
        PVCoordinates pvOne = new PVCoordinates(pos, vel, acc);
        // random transform
        FieldVector3D<T> transPos = randomVector(field, 1.0e3, rnd);
        FieldVector3D<T> transVel = randomVector(field, 1.0, rnd);
        FieldVector3D<T> transAcc = randomVector(field, 1.0e-3, rnd);
        FieldTransform<T> tr = new FieldTransform<>(FieldAbsoluteDate.getJ2000Epoch(field), transPos, transVel, transAcc);
        T dt = field.getZero().add(1);
        // we should obtain
        FieldVector3D<T> good = tr.transformPosition(new FieldVector3D<>(dt, vel).add(pos)).add(new FieldVector3D<>(dt, transVel));
        // we have
        FieldPVCoordinates<T> pvTwo = tr.transformPVCoordinates(pvOne);
        FieldVector3D<T> result = pvTwo.getPosition().add(new FieldVector3D<>(dt, pvTwo.getVelocity()));
        checkVector(good, result, 1.0e-15);
        // test inverse
        FieldVector3D<T> resultvel = tr.getInverse().transformPVCoordinates(pvTwo).getVelocity();
        checkVector(resultvel, new FieldVector3D<>(field, vel), 1.0e-15);
    }
}
Also used : FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) PVCoordinates(org.orekit.utils.PVCoordinates) TimeStampedFieldPVCoordinates(org.orekit.utils.TimeStampedFieldPVCoordinates) Well19937a(org.hipparchus.random.Well19937a) RandomGenerator(org.hipparchus.random.RandomGenerator)

Aggregations

FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)41 Frame (org.orekit.frames.Frame)27 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)22 TimeStampedFieldPVCoordinates (org.orekit.utils.TimeStampedFieldPVCoordinates)19 PVCoordinates (org.orekit.utils.PVCoordinates)17 DerivativeStructure (org.hipparchus.analysis.differentiation.DerivativeStructure)16 RandomGenerator (org.hipparchus.random.RandomGenerator)16 Well19937a (org.hipparchus.random.Well19937a)16 FieldKeplerianOrbit (org.orekit.orbits.FieldKeplerianOrbit)16 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)15 DSFactory (org.hipparchus.analysis.differentiation.DSFactory)14 Test (org.junit.Test)14 AbstractLegacyForceModelTest (org.orekit.forces.AbstractLegacyForceModelTest)13 OrbitType (org.orekit.orbits.OrbitType)13 FieldSpacecraftState (org.orekit.propagation.FieldSpacecraftState)13 SpacecraftState (org.orekit.propagation.SpacecraftState)13 FieldNumericalPropagator (org.orekit.propagation.numerical.FieldNumericalPropagator)13 NumericalPropagator (org.orekit.propagation.numerical.NumericalPropagator)13 AdaptiveStepsizeIntegrator (org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator)12 DormandPrince853FieldIntegrator (org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator)12