Search in sources :

Example 11 with Well19937a

use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.

the class PVCoordinatesTest method testNormalize.

@Test
public void testNormalize() {
    DSFactory factory = new DSFactory(1, 2);
    RandomGenerator generator = new Well19937a(0xb2011ffd25412067l);
    FiniteDifferencesDifferentiator differentiator = new FiniteDifferencesDifferentiator(5, 1.0e-3);
    for (int i = 0; i < 200; ++i) {
        final PVCoordinates pv = randomPVCoordinates(generator, 1e6, 1e3, 1.0);
        DerivativeStructure x = differentiator.differentiate(new UnivariateFunction() {

            public double value(double t) {
                return pv.shiftedBy(t).getPosition().normalize().getX();
            }
        }).value(factory.variable(0, 0.0));
        DerivativeStructure y = differentiator.differentiate(new UnivariateFunction() {

            public double value(double t) {
                return pv.shiftedBy(t).getPosition().normalize().getY();
            }
        }).value(factory.variable(0, 0.0));
        DerivativeStructure z = differentiator.differentiate(new UnivariateFunction() {

            public double value(double t) {
                return pv.shiftedBy(t).getPosition().normalize().getZ();
            }
        }).value(factory.variable(0, 0.0));
        PVCoordinates normalized = pv.normalize();
        Assert.assertEquals(x.getValue(), normalized.getPosition().getX(), 1.0e-16);
        Assert.assertEquals(y.getValue(), normalized.getPosition().getY(), 1.0e-16);
        Assert.assertEquals(z.getValue(), normalized.getPosition().getZ(), 1.0e-16);
        Assert.assertEquals(x.getPartialDerivative(1), normalized.getVelocity().getX(), 3.0e-13);
        Assert.assertEquals(y.getPartialDerivative(1), normalized.getVelocity().getY(), 3.0e-13);
        Assert.assertEquals(z.getPartialDerivative(1), normalized.getVelocity().getZ(), 3.0e-13);
        Assert.assertEquals(x.getPartialDerivative(2), normalized.getAcceleration().getX(), 6.0e-10);
        Assert.assertEquals(y.getPartialDerivative(2), normalized.getAcceleration().getY(), 6.0e-10);
        Assert.assertEquals(z.getPartialDerivative(2), normalized.getAcceleration().getZ(), 6.0e-10);
    }
}
Also used : UnivariateFunction(org.hipparchus.analysis.UnivariateFunction) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) Well19937a(org.hipparchus.random.Well19937a) RandomGenerator(org.hipparchus.random.RandomGenerator) FiniteDifferencesDifferentiator(org.hipparchus.analysis.differentiation.FiniteDifferencesDifferentiator) Test(org.junit.Test)

Example 12 with Well19937a

use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.

the class SecularAndHarmonicTest method testReset.

@Test
public void testReset() throws OrekitException {
    // Period = 6 months
    final double SUN_PULSATION = 4.0 * FastMath.PI / Constants.JULIAN_YEAR;
    // Generate two random datasets
    final RandomGenerator random = new Well19937a(0x8de2c5d0e210588dl);
    final AbsoluteDate t0 = AbsoluteDate.J2000_EPOCH;
    final double[][] data = new double[2][200];
    for (int iD = 0; iD < data[0].length; ++iD) {
        data[0][iD] = random.nextDouble();
        data[1][iD] = random.nextDouble();
    }
    // Generate three SAH models: the first two will fit each dataset
    // independently, while the third parses one dataset and then the other
    // after being reset. Fitted parameters should match in both cases.
    final double[] initialGuess = { 0.0, 0.0, 0.0, 0.0 };
    final SecularAndHarmonic[] indepModel = new SecularAndHarmonic[2];
    final SecularAndHarmonic resettingModel = new SecularAndHarmonic(1, SUN_PULSATION);
    for (int iM = 0; iM < indepModel.length; ++iM) {
        indepModel[iM] = new SecularAndHarmonic(1, SUN_PULSATION);
        indepModel[iM].resetFitting(t0, initialGuess);
        resettingModel.resetFitting(t0, initialGuess);
        for (int iD = 0; iD < data[0].length; ++iD) {
            final AbsoluteDate t = t0.shiftedBy(iD);
            indepModel[iM].addPoint(t, data[iM][iD]);
            resettingModel.addPoint(t, data[iM][iD]);
        }
        indepModel[iM].fit();
        resettingModel.fit();
        Assert.assertArrayEquals(indepModel[iM].getFittedParameters(), resettingModel.getFittedParameters(), 1e-14);
    }
}
Also used : Well19937a(org.hipparchus.random.Well19937a) RandomGenerator(org.hipparchus.random.RandomGenerator) AbsoluteDate(org.orekit.time.AbsoluteDate) GeodeticPoint(org.orekit.bodies.GeodeticPoint) Test(org.junit.Test)

Example 13 with Well19937a

use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.

the class FieldPropagation method main.

/**
 * Program entry point.
 * @param args program arguments (unused here)
 * @throws IOException
 * @throws OrekitException
 */
public static void main(String[] args) throws IOException, OrekitException {
    // the goal of this example is to make a Montecarlo simulation giving an error on the semiaxis,
    // the inclination and the RAAN. The interest of doing it with Orekit based on the
    // DerivativeStructure is that instead of doing a large number of propagation around the initial
    // point we will do a single propagation of the initial state, and thanks to the Taylor expansion
    // we will see the evolution of the std deviation of the position, which is divided in the
    // CrossTrack, the LongTrack and the Radial error.
    // configure Orekit
    File home = new File(System.getProperty("user.home"));
    File orekitData = new File(home, "orekit-data");
    if (!orekitData.exists()) {
        System.err.format(Locale.US, "Failed to find %s folder%n", orekitData.getAbsolutePath());
        System.err.format(Locale.US, "You need to download %s from the %s page and unzip it in %s for this tutorial to work%n", "orekit-data.zip", "https://www.orekit.org/forge/projects/orekit/files", home.getAbsolutePath());
        System.exit(1);
    }
    DataProvidersManager manager = DataProvidersManager.getInstance();
    manager.addProvider(new DirectoryCrawler(orekitData));
    // output file in user's home directory
    File workingDir = new File(System.getProperty("user.home"));
    File errorFile = new File(workingDir, "error.txt");
    System.out.println("Output file is in : " + errorFile.getAbsolutePath());
    PrintWriter PW = new PrintWriter(errorFile, "UTF-8");
    PW.printf("time \t\tCrossTrackErr \tLongTrackErr  \tRadialErr \tTotalErr%n");
    // setting the parameters of the simulation
    // Order of derivation of the DerivativeStructures
    int params = 3;
    int order = 3;
    DSFactory factory = new DSFactory(params, order);
    // number of samples of the montecarlo simulation
    int montecarlo_size = 100;
    // nominal values of the Orbital parameters
    double a_nominal = 7.278E6;
    double e_nominal = 1e-3;
    double i_nominal = FastMath.toRadians(98.3);
    double pa_nominal = FastMath.PI / 2;
    double raan_nominal = 0.0;
    double ni_nominal = 0.0;
    // mean of the gaussian curve for each of the errors around the nominal values
    // {a, i, RAAN}
    double[] mean = { 0, 0, 0 };
    // standard deviation of the gaussian curve for each of the errors around the nominal values
    // {dA, dI, dRaan}
    double[] dAdIdRaan = { 5, FastMath.toRadians(1e-3), FastMath.toRadians(1e-3) };
    // time of integration
    double final_Dt = 1 * 60 * 60;
    // number of steps per orbit
    double num_step_orbit = 10;
    DerivativeStructure a_0 = factory.variable(0, a_nominal);
    DerivativeStructure e_0 = factory.constant(e_nominal);
    DerivativeStructure i_0 = factory.variable(1, i_nominal);
    DerivativeStructure pa_0 = factory.constant(pa_nominal);
    DerivativeStructure raan_0 = factory.variable(2, raan_nominal);
    DerivativeStructure ni_0 = factory.constant(ni_nominal);
    // sometimes we will need the field of the DerivativeStructure to build new instances
    Field<DerivativeStructure> field = a_0.getField();
    // sometimes we will need the zero of the DerivativeStructure to build new instances
    DerivativeStructure zero = field.getZero();
    // initializing the FieldAbsoluteDate with only the field it will generate the day J2000
    FieldAbsoluteDate<DerivativeStructure> date_0 = new FieldAbsoluteDate<>(field);
    // initialize a basic frame
    Frame frame = FramesFactory.getEME2000();
    // initialize the orbit
    double mu = 3.9860047e14;
    FieldKeplerianOrbit<DerivativeStructure> KO = new FieldKeplerianOrbit<>(a_0, e_0, i_0, pa_0, raan_0, ni_0, PositionAngle.ECCENTRIC, frame, date_0, mu);
    // step of integration (how many times per orbit we take the mesures)
    double int_step = KO.getKeplerianPeriod().getReal() / num_step_orbit;
    // random generator to conduct an
    long number = 23091991;
    RandomGenerator RG = new Well19937a(number);
    GaussianRandomGenerator NGG = new GaussianRandomGenerator(RG);
    UncorrelatedRandomVectorGenerator URVG = new UncorrelatedRandomVectorGenerator(mean, dAdIdRaan, NGG);
    double[][] rand_gen = new double[montecarlo_size][3];
    for (int jj = 0; jj < montecarlo_size; jj++) {
        rand_gen[jj] = URVG.nextVector();
    }
    // 
    FieldSpacecraftState<DerivativeStructure> SS_0 = new FieldSpacecraftState<>(KO);
    // adding force models
    ForceModel fModel_Sun = new ThirdBodyAttraction(CelestialBodyFactory.getSun());
    ForceModel fModel_Moon = new ThirdBodyAttraction(CelestialBodyFactory.getMoon());
    ForceModel fModel_HFAM = new HolmesFeatherstoneAttractionModel(FramesFactory.getITRF(IERSConventions.IERS_2010, true), GravityFieldFactory.getNormalizedProvider(18, 18));
    // setting an hipparchus field integrator
    OrbitType type = OrbitType.CARTESIAN;
    double[][] tolerance = NumericalPropagator.tolerances(0.001, KO.toOrbit(), type);
    AdaptiveStepsizeFieldIntegrator<DerivativeStructure> integrator = new DormandPrince853FieldIntegrator<>(field, 0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(zero.add(60));
    // setting of the field propagator, we used the numerical one in order to add the third body attraction
    // and the holmes featherstone force models
    FieldNumericalPropagator<DerivativeStructure> numProp = new FieldNumericalPropagator<>(field, integrator);
    numProp.setOrbitType(type);
    numProp.setInitialState(SS_0);
    numProp.addForceModel(fModel_Sun);
    numProp.addForceModel(fModel_Moon);
    numProp.addForceModel(fModel_HFAM);
    // with the master mode we will calulcate and print the error on every fixed step on the file error.txt
    // we defined the StepHandler to do that giving him the random number generator,
    // the size of the montecarlo simulation and the initial date
    numProp.setMasterMode(zero.add(int_step), new MyStepHandler<DerivativeStructure>(rand_gen, montecarlo_size, date_0, PW));
    // 
    long START = System.nanoTime();
    FieldSpacecraftState<DerivativeStructure> finalState = numProp.propagate(date_0.shiftedBy(final_Dt));
    long STOP = System.nanoTime();
    System.out.println((STOP - START) / 1E6 + " ms");
    System.out.println(finalState.getDate());
    PW.close();
}
Also used : Frame(org.orekit.frames.Frame) GaussianRandomGenerator(org.hipparchus.random.GaussianRandomGenerator) ForceModel(org.orekit.forces.ForceModel) Well19937a(org.hipparchus.random.Well19937a) RandomGenerator(org.hipparchus.random.RandomGenerator) GaussianRandomGenerator(org.hipparchus.random.GaussianRandomGenerator) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) DirectoryCrawler(org.orekit.data.DirectoryCrawler) PrintWriter(java.io.PrintWriter) DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) ThirdBodyAttraction(org.orekit.forces.gravity.ThirdBodyAttraction) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) DataProvidersManager(org.orekit.data.DataProvidersManager) UncorrelatedRandomVectorGenerator(org.hipparchus.random.UncorrelatedRandomVectorGenerator) OrbitType(org.orekit.orbits.OrbitType) HolmesFeatherstoneAttractionModel(org.orekit.forces.gravity.HolmesFeatherstoneAttractionModel) File(java.io.File) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate)

Example 14 with Well19937a

use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.

the class ConstantThrustManeuverTest method RealFieldTest.

/**
 *Testing if the propagation between the FieldPropagation and the propagation
 * is equivalent.
 * Also testing if propagating X+dX with the propagation is equivalent to
 * propagation X with the FieldPropagation and then applying the taylor
 * expansion of dX to the result.
 */
@Test
public void RealFieldTest() throws OrekitException {
    DSFactory factory = new DSFactory(6, 5);
    DerivativeStructure a_0 = factory.variable(0, 7e7);
    DerivativeStructure e_0 = factory.variable(1, 0.4);
    DerivativeStructure i_0 = factory.variable(2, 85 * FastMath.PI / 180);
    DerivativeStructure R_0 = factory.variable(3, 0.7);
    DerivativeStructure O_0 = factory.variable(4, 0.5);
    DerivativeStructure n_0 = factory.variable(5, 0.1);
    Field<DerivativeStructure> field = a_0.getField();
    DerivativeStructure zero = field.getZero();
    FieldAbsoluteDate<DerivativeStructure> J2000 = new FieldAbsoluteDate<>(field);
    Frame EME = FramesFactory.getEME2000();
    FieldKeplerianOrbit<DerivativeStructure> FKO = new FieldKeplerianOrbit<>(a_0, e_0, i_0, R_0, O_0, n_0, PositionAngle.MEAN, EME, J2000, Constants.EIGEN5C_EARTH_MU);
    FieldSpacecraftState<DerivativeStructure> initialState = new FieldSpacecraftState<>(FKO);
    SpacecraftState iSR = initialState.toSpacecraftState();
    final OrbitType type = OrbitType.KEPLERIAN;
    double[][] tolerance = NumericalPropagator.tolerances(10.0, FKO.toOrbit(), type);
    AdaptiveStepsizeFieldIntegrator<DerivativeStructure> integrator = new DormandPrince853FieldIntegrator<>(field, 0.001, 200, tolerance[0], tolerance[1]);
    integrator.setInitialStepSize(zero.add(60));
    AdaptiveStepsizeIntegrator RIntegrator = new DormandPrince853Integrator(0.001, 200, tolerance[0], tolerance[1]);
    RIntegrator.setInitialStepSize(60);
    FieldNumericalPropagator<DerivativeStructure> FNP = new FieldNumericalPropagator<>(field, integrator);
    FNP.setOrbitType(type);
    FNP.setInitialState(initialState);
    NumericalPropagator NP = new NumericalPropagator(RIntegrator);
    NP.setOrbitType(type);
    NP.setInitialState(iSR);
    final ConstantThrustManeuver forceModel = new ConstantThrustManeuver(J2000.toAbsoluteDate().shiftedBy(100), 100.0, 400.0, 300.0, Vector3D.PLUS_K);
    FNP.addForceModel(forceModel);
    NP.addForceModel(forceModel);
    FieldAbsoluteDate<DerivativeStructure> target = J2000.shiftedBy(1000.);
    FieldSpacecraftState<DerivativeStructure> finalState_DS = FNP.propagate(target);
    SpacecraftState finalState_R = NP.propagate(target.toAbsoluteDate());
    FieldPVCoordinates<DerivativeStructure> finPVC_DS = finalState_DS.getPVCoordinates();
    PVCoordinates finPVC_R = finalState_R.getPVCoordinates();
    Assert.assertEquals(finPVC_DS.toPVCoordinates().getPosition().getX(), finPVC_R.getPosition().getX(), FastMath.abs(finPVC_R.getPosition().getX()) * 1e-11);
    Assert.assertEquals(finPVC_DS.toPVCoordinates().getPosition().getY(), finPVC_R.getPosition().getY(), FastMath.abs(finPVC_R.getPosition().getY()) * 1e-11);
    Assert.assertEquals(finPVC_DS.toPVCoordinates().getPosition().getZ(), finPVC_R.getPosition().getZ(), FastMath.abs(finPVC_R.getPosition().getZ()) * 1e-11);
    long number = 23091991;
    RandomGenerator RG = new Well19937a(number);
    GaussianRandomGenerator NGG = new GaussianRandomGenerator(RG);
    UncorrelatedRandomVectorGenerator URVG = new UncorrelatedRandomVectorGenerator(new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 }, new double[] { 1e3, 0.01, 0.01, 0.01, 0.01, 0.01 }, NGG);
    double a_R = a_0.getReal();
    double e_R = e_0.getReal();
    double i_R = i_0.getReal();
    double R_R = R_0.getReal();
    double O_R = O_0.getReal();
    double n_R = n_0.getReal();
    for (int ii = 0; ii < 1; ii++) {
        double[] rand_next = URVG.nextVector();
        double a_shift = a_R + rand_next[0];
        double e_shift = e_R + rand_next[1];
        double i_shift = i_R + rand_next[2];
        double R_shift = R_R + rand_next[3];
        double O_shift = O_R + rand_next[4];
        double n_shift = n_R + rand_next[5];
        KeplerianOrbit shiftedOrb = new KeplerianOrbit(a_shift, e_shift, i_shift, R_shift, O_shift, n_shift, PositionAngle.MEAN, EME, J2000.toAbsoluteDate(), Constants.EIGEN5C_EARTH_MU);
        SpacecraftState shift_iSR = new SpacecraftState(shiftedOrb);
        NumericalPropagator shift_NP = new NumericalPropagator(RIntegrator);
        shift_NP.setInitialState(shift_iSR);
        shift_NP.addForceModel(forceModel);
        SpacecraftState finalState_shift = shift_NP.propagate(target.toAbsoluteDate());
        PVCoordinates finPVC_shift = finalState_shift.getPVCoordinates();
        // position check
        FieldVector3D<DerivativeStructure> pos_DS = finPVC_DS.getPosition();
        double x_DS = pos_DS.getX().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double y_DS = pos_DS.getY().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double z_DS = pos_DS.getZ().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        // System.out.println(pos_DS.getX().getPartialDerivative(1));
        double x = finPVC_shift.getPosition().getX();
        double y = finPVC_shift.getPosition().getY();
        double z = finPVC_shift.getPosition().getZ();
        Assert.assertEquals(x_DS, x, FastMath.abs(x - pos_DS.getX().getReal()) * 1e-8);
        Assert.assertEquals(y_DS, y, FastMath.abs(y - pos_DS.getY().getReal()) * 1e-8);
        Assert.assertEquals(z_DS, z, FastMath.abs(z - pos_DS.getZ().getReal()) * 1e-8);
        // velocity check
        FieldVector3D<DerivativeStructure> vel_DS = finPVC_DS.getVelocity();
        double vx_DS = vel_DS.getX().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double vy_DS = vel_DS.getY().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double vz_DS = vel_DS.getZ().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double vx = finPVC_shift.getVelocity().getX();
        double vy = finPVC_shift.getVelocity().getY();
        double vz = finPVC_shift.getVelocity().getZ();
        Assert.assertEquals(vx_DS, vx, FastMath.abs(vx) * 1e-9);
        Assert.assertEquals(vy_DS, vy, FastMath.abs(vy) * 1e-9);
        Assert.assertEquals(vz_DS, vz, FastMath.abs(vz) * 1e-9);
        // acceleration check
        FieldVector3D<DerivativeStructure> acc_DS = finPVC_DS.getAcceleration();
        double ax_DS = acc_DS.getX().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double ay_DS = acc_DS.getY().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double az_DS = acc_DS.getZ().taylor(rand_next[0], rand_next[1], rand_next[2], rand_next[3], rand_next[4], rand_next[5]);
        double ax = finPVC_shift.getAcceleration().getX();
        double ay = finPVC_shift.getAcceleration().getY();
        double az = finPVC_shift.getAcceleration().getZ();
        Assert.assertEquals(ax_DS, ax, FastMath.abs(ax) * 1e-8);
        Assert.assertEquals(ay_DS, ay, FastMath.abs(ay) * 1e-8);
        Assert.assertEquals(az_DS, az, FastMath.abs(az) * 1e-8);
    }
}
Also used : Frame(org.orekit.frames.Frame) GaussianRandomGenerator(org.hipparchus.random.GaussianRandomGenerator) AdaptiveStepsizeIntegrator(org.hipparchus.ode.nonstiff.AdaptiveStepsizeIntegrator) PVCoordinates(org.orekit.utils.PVCoordinates) FieldPVCoordinates(org.orekit.utils.FieldPVCoordinates) Well19937a(org.hipparchus.random.Well19937a) RandomGenerator(org.hipparchus.random.RandomGenerator) GaussianRandomGenerator(org.hipparchus.random.GaussianRandomGenerator) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) SpacecraftState(org.orekit.propagation.SpacecraftState) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) NumericalPropagator(org.orekit.propagation.numerical.NumericalPropagator) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) FieldKeplerianOrbit(org.orekit.orbits.FieldKeplerianOrbit) KeplerianOrbit(org.orekit.orbits.KeplerianOrbit) DormandPrince853Integrator(org.hipparchus.ode.nonstiff.DormandPrince853Integrator) DormandPrince853FieldIntegrator(org.hipparchus.ode.nonstiff.DormandPrince853FieldIntegrator) FieldSpacecraftState(org.orekit.propagation.FieldSpacecraftState) DerivativeStructure(org.hipparchus.analysis.differentiation.DerivativeStructure) DSFactory(org.hipparchus.analysis.differentiation.DSFactory) FieldNumericalPropagator(org.orekit.propagation.numerical.FieldNumericalPropagator) OrbitType(org.orekit.orbits.OrbitType) UncorrelatedRandomVectorGenerator(org.hipparchus.random.UncorrelatedRandomVectorGenerator) FieldAbsoluteDate(org.orekit.time.FieldAbsoluteDate) AbstractLegacyForceModelTest(org.orekit.forces.AbstractLegacyForceModelTest) Test(org.junit.Test)

Example 15 with Well19937a

use of org.hipparchus.random.Well19937a in project Orekit by CS-SI.

the class TransformTest method testRotation.

@Test
public void testRotation() {
    RandomGenerator rnd = new Well19937a(0x73d5554d99427af0l);
    for (int i = 0; i < 10; ++i) {
        Rotation r = randomRotation(rnd);
        Vector3D axis = r.getAxis(RotationConvention.VECTOR_OPERATOR);
        double angle = r.getAngle();
        Transform transform = new Transform(AbsoluteDate.J2000_EPOCH, r);
        for (int j = 0; j < 10; ++j) {
            Vector3D a = new Vector3D(rnd.nextDouble(), rnd.nextDouble(), rnd.nextDouble());
            Vector3D b = transform.transformVector(a);
            Assert.assertEquals(Vector3D.angle(axis, a), Vector3D.angle(axis, b), 1.0e-14);
            Vector3D aOrtho = Vector3D.crossProduct(axis, a);
            Vector3D bOrtho = Vector3D.crossProduct(axis, b);
            Assert.assertEquals(angle, Vector3D.angle(aOrtho, bOrtho), 1.0e-14);
            Vector3D c = transform.transformPosition(a);
            Assert.assertEquals(0, c.subtract(b).getNorm(), 1.0e-14);
        }
    }
}
Also used : FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Well19937a(org.hipparchus.random.Well19937a) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) 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