Example usage for org.apache.commons.math3.geometry.euclidean.threed Vector3D PLUS_J

List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Vector3D PLUS_J

Introduction

In this page you can find the example usage for org.apache.commons.math3.geometry.euclidean.threed Vector3D PLUS_J.

Prototype

Vector3D PLUS_J

To view the source code for org.apache.commons.math3.geometry.euclidean.threed Vector3D PLUS_J.

Click Source Link

Document

Second canonical vector (coordinates: 0, 1, 0).

Usage

From source file:org.orekit.forces.gravity.HolmesFeatherstoneAttractionModelTest.java

private double[] gradient(final HolmesFeatherstoneAttractionModel model, final AbsoluteDate date,
        final Vector3D position, final double h) throws OrekitException {
    return new double[] {
            differential8(model.nonCentralPart(date, position.add(new Vector3D(-4 * h, Vector3D.PLUS_I))),
                    model.nonCentralPart(date, position.add(new Vector3D(-3 * h, Vector3D.PLUS_I))),
                    model.nonCentralPart(date, position.add(new Vector3D(-2 * h, Vector3D.PLUS_I))),
                    model.nonCentralPart(date, position.add(new Vector3D(-1 * h, Vector3D.PLUS_I))),
                    model.nonCentralPart(date, position.add(new Vector3D(+1 * h, Vector3D.PLUS_I))),
                    model.nonCentralPart(date, position.add(new Vector3D(+2 * h, Vector3D.PLUS_I))),
                    model.nonCentralPart(date, position.add(new Vector3D(+3 * h, Vector3D.PLUS_I))),
                    model.nonCentralPart(date, position.add(new Vector3D(+4 * h, Vector3D.PLUS_I))), h),
            differential8(model.nonCentralPart(date, position.add(new Vector3D(-4 * h, Vector3D.PLUS_J))),
                    model.nonCentralPart(date, position.add(new Vector3D(-3 * h, Vector3D.PLUS_J))),
                    model.nonCentralPart(date, position.add(new Vector3D(-2 * h, Vector3D.PLUS_J))),
                    model.nonCentralPart(date, position.add(new Vector3D(-1 * h, Vector3D.PLUS_J))),
                    model.nonCentralPart(date, position.add(new Vector3D(+1 * h, Vector3D.PLUS_J))),
                    model.nonCentralPart(date, position.add(new Vector3D(+2 * h, Vector3D.PLUS_J))),
                    model.nonCentralPart(date, position.add(new Vector3D(+3 * h, Vector3D.PLUS_J))),
                    model.nonCentralPart(date, position.add(new Vector3D(+4 * h, Vector3D.PLUS_J))), h),
            differential8(model.nonCentralPart(date, position.add(new Vector3D(-4 * h, Vector3D.PLUS_K))),
                    model.nonCentralPart(date, position.add(new Vector3D(-3 * h, Vector3D.PLUS_K))),
                    model.nonCentralPart(date, position.add(new Vector3D(-2 * h, Vector3D.PLUS_K))),
                    model.nonCentralPart(date, position.add(new Vector3D(-1 * h, Vector3D.PLUS_K))),
                    model.nonCentralPart(date, position.add(new Vector3D(+1 * h, Vector3D.PLUS_K))),
                    model.nonCentralPart(date, position.add(new Vector3D(+2 * h, Vector3D.PLUS_K))),
                    model.nonCentralPart(date, position.add(new Vector3D(+3 * h, Vector3D.PLUS_K))),
                    model.nonCentralPart(date, position.add(new Vector3D(+4 * h, Vector3D.PLUS_K))), h) };
}

From source file:org.orekit.forces.gravity.HolmesFeatherstoneAttractionModelTest.java

private double[][] hessian(final HolmesFeatherstoneAttractionModel model, final AbsoluteDate date,
        final Vector3D position, final double h) throws OrekitException {
    return new double[][] {
            differential8(model.gradient(date, position.add(new Vector3D(-4 * h, Vector3D.PLUS_I))),
                    model.gradient(date, position.add(new Vector3D(-3 * h, Vector3D.PLUS_I))),
                    model.gradient(date, position.add(new Vector3D(-2 * h, Vector3D.PLUS_I))),
                    model.gradient(date, position.add(new Vector3D(-1 * h, Vector3D.PLUS_I))),
                    model.gradient(date, position.add(new Vector3D(+1 * h, Vector3D.PLUS_I))),
                    model.gradient(date, position.add(new Vector3D(+2 * h, Vector3D.PLUS_I))),
                    model.gradient(date, position.add(new Vector3D(+3 * h, Vector3D.PLUS_I))),
                    model.gradient(date, position.add(new Vector3D(+4 * h, Vector3D.PLUS_I))), h),
            differential8(model.gradient(date, position.add(new Vector3D(-4 * h, Vector3D.PLUS_J))),
                    model.gradient(date, position.add(new Vector3D(-3 * h, Vector3D.PLUS_J))),
                    model.gradient(date, position.add(new Vector3D(-2 * h, Vector3D.PLUS_J))),
                    model.gradient(date, position.add(new Vector3D(-1 * h, Vector3D.PLUS_J))),
                    model.gradient(date, position.add(new Vector3D(+1 * h, Vector3D.PLUS_J))),
                    model.gradient(date, position.add(new Vector3D(+2 * h, Vector3D.PLUS_J))),
                    model.gradient(date, position.add(new Vector3D(+3 * h, Vector3D.PLUS_J))),
                    model.gradient(date, position.add(new Vector3D(+4 * h, Vector3D.PLUS_J))), h),
            differential8(model.gradient(date, position.add(new Vector3D(-4 * h, Vector3D.PLUS_K))),
                    model.gradient(date, position.add(new Vector3D(-3 * h, Vector3D.PLUS_K))),
                    model.gradient(date, position.add(new Vector3D(-2 * h, Vector3D.PLUS_K))),
                    model.gradient(date, position.add(new Vector3D(-1 * h, Vector3D.PLUS_K))),
                    model.gradient(date, position.add(new Vector3D(+1 * h, Vector3D.PLUS_K))),
                    model.gradient(date, position.add(new Vector3D(+2 * h, Vector3D.PLUS_K))),
                    model.gradient(date, position.add(new Vector3D(+3 * h, Vector3D.PLUS_K))),
                    model.gradient(date, position.add(new Vector3D(+4 * h, Vector3D.PLUS_K))), h) };
}

From source file:org.orekit.forces.maneuvers.ConstantThrustManeuverTest.java

private CircularOrbit dummyOrbit(AbsoluteDate date) {
    return new CircularOrbit(new PVCoordinates(Vector3D.PLUS_I, Vector3D.PLUS_J), FramesFactory.getEME2000(),
            date, mu);/*from  w ww  .j  a va2 s.  c  o  m*/
}

From source file:org.orekit.forces.maneuvers.ImpulseManeuverTest.java

@Test
public void testInclinationManeuver() throws OrekitException {
    final Orbit initialOrbit = new KeplerianOrbit(24532000.0, 0.72, 0.3, FastMath.PI, 0.4, 2.0,
            PositionAngle.MEAN, FramesFactory.getEME2000(), new AbsoluteDate(new DateComponents(2008, 06, 23),
                    new TimeComponents(14, 18, 37), TimeScalesFactory.getUTC()),
            3.986004415e14);/* w  ww.j a v a  2  s.  c  o  m*/
    final double a = initialOrbit.getA();
    final double e = initialOrbit.getE();
    final double i = initialOrbit.getI();
    final double mu = initialOrbit.getMu();
    final double vApo = FastMath.sqrt(mu * (1 - e) / (a * (1 + e)));
    double dv = 0.99 * FastMath.tan(i) * vApo;
    KeplerianPropagator propagator = new KeplerianPropagator(initialOrbit,
            new LofOffset(initialOrbit.getFrame(), LOFType.VVLH));
    propagator.addEventDetector(
            new ImpulseManeuver<NodeDetector>(new NodeDetector(initialOrbit, FramesFactory.getEME2000()),
                    new Vector3D(dv, Vector3D.PLUS_J), 400.0));
    SpacecraftState propagated = propagator.propagate(initialOrbit.getDate().shiftedBy(8000));
    Assert.assertEquals(0.0028257, propagated.getI(), 1.0e-6);
}

From source file:org.orekit.forces.maneuvers.SmallManeuverAnalyticalModelTest.java

@Test
public void testJacobian() throws OrekitException {

    Frame eme2000 = FramesFactory.getEME2000();
    Orbit leo = new CircularOrbit(
            7200000.0, -1.0e-2, 2.0e-3, FastMath.toRadians(98.0), FastMath.toRadians(123.456), 0.3,
            PositionAngle.MEAN, eme2000, new AbsoluteDate(new DateComponents(2004, 01, 01),
                    new TimeComponents(23, 30, 00.000), TimeScalesFactory.getUTC()),
            Constants.EIGEN5C_EARTH_MU);
    double mass = 5600.0;
    AbsoluteDate t0 = leo.getDate().shiftedBy(1000.0);
    Vector3D dV0 = new Vector3D(-0.1, 0.2, 0.3);
    double f = 400.0;
    double isp = 315.0;

    for (OrbitType orbitType : OrbitType.values()) {
        for (PositionAngle positionAngle : PositionAngle.values()) {
            BoundedPropagator withoutManeuver = getEphemeris(orbitType.convertType(leo), mass, t0,
                    Vector3D.ZERO, f, isp);

            SpacecraftState state0 = withoutManeuver.propagate(t0);
            SmallManeuverAnalyticalModel model = new SmallManeuverAnalyticalModel(state0, eme2000, dV0, isp);
            Assert.assertEquals(t0, model.getDate());

            Vector3D[] velDirs = new Vector3D[] { Vector3D.PLUS_I, Vector3D.PLUS_J, Vector3D.PLUS_K,
                    Vector3D.ZERO };
            double[] timeDirs = new double[] { 0, 0, 0, 1 };
            double h = 1.0;
            AbsoluteDate t1 = t0.shiftedBy(20.0);
            for (int i = 0; i < 4; ++i) {

                SmallManeuverAnalyticalModel[] models = new SmallManeuverAnalyticalModel[] {
                        new SmallManeuverAnalyticalModel(
                                withoutManeuver.propagate(t0.shiftedBy(-4 * h * timeDirs[i])), eme2000,
                                new Vector3D(1, dV0, -4 * h, velDirs[i]), isp),
                        new SmallManeuverAnalyticalModel(
                                withoutManeuver.propagate(t0.shiftedBy(-3 * h * timeDirs[i])), eme2000,
                                new Vector3D(1, dV0, -3 * h, velDirs[i]), isp),
                        new SmallManeuverAnalyticalModel(
                                withoutManeuver.propagate(t0.shiftedBy(-2 * h * timeDirs[i])), eme2000,
                                new Vector3D(1, dV0, -2 * h, velDirs[i]), isp),
                        new SmallManeuverAnalyticalModel(
                                withoutManeuver.propagate(t0.shiftedBy(-1 * h * timeDirs[i])), eme2000,
                                new Vector3D(1, dV0, -1 * h, velDirs[i]), isp),
                        new SmallManeuverAnalyticalModel(
                                withoutManeuver.propagate(t0.shiftedBy(+1 * h * timeDirs[i])), eme2000,
                                new Vector3D(1, dV0, +1 * h, velDirs[i]), isp),
                        new SmallManeuverAnalyticalModel(
                                withoutManeuver.propagate(t0.shiftedBy(+2 * h * timeDirs[i])), eme2000,
                                new Vector3D(1, dV0, +2 * h, velDirs[i]), isp),
                        new SmallManeuverAnalyticalModel(
                                withoutManeuver.propagate(t0.shiftedBy(+3 * h * timeDirs[i])), eme2000,
                                new Vector3D(1, dV0, +3 * h, velDirs[i]), isp),
                        new SmallManeuverAnalyticalModel(
                                withoutManeuver.propagate(t0.shiftedBy(+4 * h * timeDirs[i])), eme2000,
                                new Vector3D(1, dV0, +4 * h, velDirs[i]), isp), };
                double[][] array = new double[models.length][6];

                Orbit orbitWithout = withoutManeuver.propagate(t1).getOrbit();

                // compute reference orbit gradient by finite differences
                double c = 1.0 / (840 * h);
                for (int j = 0; j < models.length; ++j) {
                    orbitType.mapOrbitToArray(models[j].apply(orbitWithout), positionAngle, array[j]);
                }//from   ww  w .j  a va 2  s  .  c o m
                double[] orbitGradient = new double[6];
                for (int k = 0; k < orbitGradient.length; ++k) {
                    double d4 = array[7][k] - array[0][k];
                    double d3 = array[6][k] - array[1][k];
                    double d2 = array[5][k] - array[2][k];
                    double d1 = array[4][k] - array[3][k];
                    orbitGradient[k] = (-3 * d4 + 32 * d3 - 168 * d2 + 672 * d1) * c;
                }

                // analytical Jacobian to check
                double[][] jacobian = new double[6][4];
                model.getJacobian(orbitWithout, positionAngle, jacobian);

                for (int j = 0; j < orbitGradient.length; ++j) {
                    Assert.assertEquals(orbitGradient[j], jacobian[j][i],
                            7.0e-6 * FastMath.abs(orbitGradient[j]));
                }

            }

        }

    }

}

From source file:org.orekit.forces.radiation.SolarRadiationPressureTest.java

@Test
public void testParameterDerivativeBox() throws OrekitException {

    final Vector3D pos = new Vector3D(6.46885878304673824e+06, -1.88050918456274318e+06,
            -1.32931592294715829e+04);//  w w  w  .j a v  a  2  s  . c  o  m
    final Vector3D vel = new Vector3D(2.14718074509906819e+03, 7.38239351251748485e+03,
            -1.14097953925384523e+01);
    final SpacecraftState state = new SpacecraftState(new CartesianOrbit(new PVCoordinates(pos, vel),
            FramesFactory.getGCRF(), new AbsoluteDate(2003, 3, 5, 0, 24, 0.0, TimeScalesFactory.getTAI()),
            Constants.EIGEN5C_EARTH_MU));

    SolarRadiationPressure forceModel = new SolarRadiationPressure(CelestialBodyFactory.getSun(),
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS, new BoxAndSolarArraySpacecraft(1.5, 2.0, 1.8,
                    CelestialBodyFactory.getSun(), 20.0, Vector3D.PLUS_J, 1.2, 0.7, 0.2));

    checkParameterDerivative(state, forceModel, RadiationSensitive.ABSORPTION_COEFFICIENT, 1.0, 4.0e-16);
    checkParameterDerivative(state, forceModel, RadiationSensitive.REFLECTION_COEFFICIENT, 1.0, 3.0e-15);

}

From source file:org.orekit.forces.radiation.SolarRadiationPressureTest.java

@Test
public void testStateJacobianBox() throws OrekitException {

    // initialization
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2003, 03, 01), new TimeComponents(13, 59, 27.816),
            TimeScalesFactory.getUTC());
    double i = FastMath.toRadians(98.7);
    double omega = FastMath.toRadians(93.0);
    double OMEGA = FastMath.toRadians(15.0 * 22.5);
    Orbit orbit = new KeplerianOrbit(7201009.7124401, 1e-3, i, omega, OMEGA, 0, PositionAngle.MEAN,
            FramesFactory.getEME2000(), date, Constants.EIGEN5C_EARTH_MU);
    OrbitType integrationType = OrbitType.CARTESIAN;
    double[][] tolerances = NumericalPropagator.tolerances(0.01, orbit, integrationType);

    NumericalPropagator propagator = new NumericalPropagator(
            new DormandPrince853Integrator(1.0e-3, 120, tolerances[0], tolerances[1]));
    propagator.setOrbitType(integrationType);
    SolarRadiationPressure forceModel = new SolarRadiationPressure(CelestialBodyFactory.getSun(),
            Constants.WGS84_EARTH_EQUATORIAL_RADIUS, new BoxAndSolarArraySpacecraft(1.5, 2.0, 1.8,
                    CelestialBodyFactory.getSun(), 20.0, Vector3D.PLUS_J, 1.2, 0.7, 0.2));
    propagator.addForceModel(forceModel);
    SpacecraftState state0 = new SpacecraftState(orbit);

    checkStateJacobian(propagator, state0, date.shiftedBy(3.5 * 3600.0), 1e3, tolerances[0], 2.0e-5);

}

From source file:org.orekit.frames.EME2000Provider.java

/** Simple constructor.
 *//*  ww  w.j  a  v a  2s .c  o m*/
protected EME2000Provider() {

    // build the bias transform
    super(new Transform(AbsoluteDate.J2000_EPOCH,
            new Rotation(Vector3D.PLUS_I, D_EPSILON_B)
                    .applyTo(new Rotation(Vector3D.PLUS_J, -D_PSI_B * FastMath.sin(EPSILON_0))
                            .applyTo(new Rotation(Vector3D.PLUS_K, -ALPHA_0)))));

}

From source file:org.orekit.frames.ITRFProvider.java

/** Get the transform from TIRF 2000 at specified date.
 * <p>The update considers the pole motion from IERS data.</p>
 * @param date new value of the date// www.j a v  a  2  s . c o m
 * @return transform at the specified date
 * @exception OrekitException if the nutation model data embedded in the
 * library cannot be read
 */
public Transform getTransform(final AbsoluteDate date) throws OrekitException {

    // offset from J2000 epoch in julian centuries
    final double tts = date.durationFrom(AbsoluteDate.J2000_EPOCH);
    final double ttc = tts / Constants.JULIAN_CENTURY;

    // pole correction parameters
    final PoleCorrection eop = eopHistory.getPoleCorrection(date);

    // elementary rotations due to pole motion in terrestrial frame
    final Rotation r1 = new Rotation(Vector3D.PLUS_I, -eop.getYp());
    final Rotation r2 = new Rotation(Vector3D.PLUS_J, -eop.getXp());
    final Rotation r3 = new Rotation(Vector3D.PLUS_K, S_PRIME_RATE * ttc);

    // complete pole motion in terrestrial frame
    final Rotation wRot = r3.applyTo(r2.applyTo(r1));

    // combined effects
    final Rotation combined = wRot.revert();

    // set up the transform from parent TIRF
    return new Transform(date, combined, Vector3D.ZERO);

}

From source file:org.orekit.frames.ITRFProviderWithoutTidalEffectsTest.java

@Test
public void testRoughOrientation() throws OrekitException {

    AbsoluteDate date = new AbsoluteDate(2001, 03, 21, 0, 4, 0, TimeScalesFactory.getUTC());
    Frame itrf2008 = FramesFactory.getITRF(IERSConventions.IERS_2010, true);

    Vector3D u = itrf2008.getTransformTo(FramesFactory.getEME2000(), date).transformVector(Vector3D.PLUS_I);
    Assert.assertTrue(Vector3D.angle(u, Vector3D.MINUS_I) < FastMath.toRadians(0.5));

    date = date.shiftedBy(6 * 3600);/* w  w w. java2 s  .c  om*/
    u = itrf2008.getTransformTo(FramesFactory.getEME2000(), date).transformVector(Vector3D.PLUS_I);
    Assert.assertTrue(Vector3D.angle(u, Vector3D.MINUS_J) < FastMath.toRadians(0.5));

    date = date.shiftedBy(6 * 3600);
    u = itrf2008.getTransformTo(FramesFactory.getEME2000(), date).transformVector(Vector3D.PLUS_I);
    Assert.assertTrue(Vector3D.angle(u, Vector3D.PLUS_I) < FastMath.toRadians(0.5));

    date = date.shiftedBy(6 * 3600);
    u = itrf2008.getTransformTo(FramesFactory.getEME2000(), date).transformVector(Vector3D.PLUS_I);
    Assert.assertTrue(Vector3D.angle(u, Vector3D.PLUS_J) < FastMath.toRadians(0.5));

}