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);
}
}
Aggregations