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

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

Introduction

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

Prototype

Vector3D PLUS_K

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

Click Source Link

Document

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

Usage

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

@Test
public void testPositiveDuration() throws OrekitException {
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000),
            TimeScalesFactory.getUTC());
    ConstantThrustManeuver maneuver = new ConstantThrustManeuver(date, 10.0, 400.0, 300.0, Vector3D.PLUS_K);
    EventDetector[] switches = maneuver.getEventsDetectors();

    Orbit o1 = dummyOrbit(date.shiftedBy(-1.0));
    Assert.assertTrue(switches[0].g(new SpacecraftState(o1)) < 0);
    Orbit o2 = dummyOrbit(date.shiftedBy(1.0));
    Assert.assertTrue(switches[0].g(new SpacecraftState(o2)) > 0);
    Orbit o3 = dummyOrbit(date.shiftedBy(9.0));
    Assert.assertTrue(switches[1].g(new SpacecraftState(o3)) < 0);
    Orbit o4 = dummyOrbit(date.shiftedBy(11.0));
    Assert.assertTrue(switches[1].g(new SpacecraftState(o4)) > 0);
}

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

@Test
public void testNegativeDuration() throws OrekitException {
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2004, 01, 01), new TimeComponents(23, 30, 00.000),
            TimeScalesFactory.getUTC());
    ConstantThrustManeuver maneuver = new ConstantThrustManeuver(date, -10.0, 400.0, 300.0, Vector3D.PLUS_K);
    EventDetector[] switches = maneuver.getEventsDetectors();

    Orbit o1 = dummyOrbit(date.shiftedBy(-11.0));
    Assert.assertTrue(switches[0].g(new SpacecraftState(o1)) < 0);
    Orbit o2 = dummyOrbit(date.shiftedBy(-9.0));
    Assert.assertTrue(switches[0].g(new SpacecraftState(o2)) > 0);
    Orbit o3 = dummyOrbit(date.shiftedBy(-1.0));
    Assert.assertTrue(switches[1].g(new SpacecraftState(o3)) < 0);
    Orbit o4 = dummyOrbit(date.shiftedBy(1.0));
    Assert.assertTrue(switches[1].g(new SpacecraftState(o4)) > 0);
}

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 w  ww . jav a 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.frames.EME2000Provider.java

/** Simple constructor.
 *///from  www .  j  a  v  a2 s . 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.FramesFactoryTest.java

private void testCIP(IERSConventions conventions, double threshold) throws OrekitException {
    Utils.setLoaders(conventions, new ArrayList<EOPEntry>());
    Frame cirf = FramesFactory.getCIRF(conventions, false);
    Frame tod = FramesFactory.getTOD(conventions, false);
    AbsoluteDate t0 = new AbsoluteDate(new DateComponents(2003, 06, 21), TimeComponents.H00,
            TimeScalesFactory.getUTC());
    for (double dt = -30 * Constants.JULIAN_DAY; dt < 30 * Constants.JULIAN_DAY; dt += 3600) {
        // CIRF and TOD should both have the Celestial Intermediate Pole as their Z axis
        AbsoluteDate date = t0.shiftedBy(dt);
        Transform t = FramesFactory.getNonInterpolatingTransform(tod, cirf, date);
        Vector3D z = t.transformVector(Vector3D.PLUS_K);
        Assert.assertEquals(0.0, Vector3D.angle(z, Vector3D.PLUS_K), threshold);
    }// www .j  a  v  a  2  s .  c  om
}

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

@Test
public void testEOPConversion() throws OrekitException {

    // real data from buletinb-298.txt

    // first use case: don't propagate the dx, dy correction to TOD, set dPsi, dEpsilon to 0.0
    final List<EOPEntry> forced = Utils.buildEOPList(IERSConventions.IERS_2010,
            new double[][] { { 56202, 0.3726886, 0.0008843, 0.168556, 0.332869, 0.0, 0.0, -0.000118, 0.000091 },
                    { 56203, 0.3719108, 0.0007204, 0.168261, 0.331527, 0.0, 0.0, -0.000140, 0.000111 },
                    { 56204, 0.3712561, 0.0006217, 0.168218, 0.330668, 0.0, 0.0, -0.000165, 0.000148 },
                    { 56205, 0.3706736, 0.0005530, 0.167775, 0.329688, 0.0, 0.0, -0.000188, 0.000189 },
                    { 56206, 0.3701593, 0.0005139, 0.166829, 0.328457, 0.0, 0.0, -0.000180, 0.000203 } });

    Utils.setLoaders(IERSConventions.IERS_2010, forced);
    Frame cirf = FramesFactory.getCIRF(IERSConventions.IERS_2010, false);
    Frame todNoCorrection = FramesFactory.getTOD(IERSConventions.IERS_2010, false);

    // second use case: convert dx, dy data into dDPsi, dDEpsilon
    final List<EOPEntry> converted = Utils.buildEOPList(IERSConventions.IERS_2010, new double[][] {
            { 56202, 0.3726886, 0.0008843, 0.168556, 0.332869, Double.NaN, Double.NaN, -0.000118, 0.000091 },
            { 56203, 0.3719108, 0.0007204, 0.168261, 0.331527, Double.NaN, Double.NaN, -0.000140, 0.000111 },
            { 56204, 0.3712561, 0.0006217, 0.168218, 0.330668, Double.NaN, Double.NaN, -0.000165, 0.000148 },
            { 56205, 0.3706736, 0.0005530, 0.167775, 0.329688, Double.NaN, Double.NaN, -0.000188, 0.000189 },
            { 56206, 0.3701593, 0.0005139, 0.166829, 0.328457, Double.NaN, Double.NaN, -0.000180, 0.000203 } });
    Utils.setLoaders(IERSConventions.IERS_2010, converted);
    Frame todConvertedCorrection = FramesFactory.getTOD(IERSConventions.IERS_2010, false);

    for (AbsoluteDate date = forced.get(0).getDate(); date
            .compareTo(forced.get(forced.size() - 1).getDate()) < 0; date = date.shiftedBy(3600)) {
        Transform tNoCorrection = FramesFactory.getNonInterpolatingTransform(todNoCorrection, cirf, date);

        // when we forget the correction on TOD,
        // its Z axis is slightly offset from CIRF Z axis
        Vector3D zNoCorrection = tNoCorrection.transformVector(Vector3D.PLUS_K);
        Assert.assertTrue(Vector3D.angle(zNoCorrection, Vector3D.PLUS_K) > 7.2e-10);
        Transform tConverted = FramesFactory.getNonInterpolatingTransform(todConvertedCorrection, cirf, date);
        // when we convert the correction and apply it to TOD,
        // its Z axis is much better aligned with CIRF Z axis
        Vector3D zConverted = tConverted.transformVector(Vector3D.PLUS_K);
        Assert.assertTrue(Vector3D.angle(zConverted, Vector3D.PLUS_K) < 6e-12);

    }//ww  w  . ja  v a  2  s. c o  m

}

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

/** Get the transform from TOD at specified date.
 * <p>The update considers the Earth rotation from IERS data.</p>
 * @param date new value of the date/* w w w.  ja va2 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 {

    // compute Greenwich apparent sidereal time, in radians
    final double gast = gastFunction.value(date).getValue();

    // compute true angular rotation of Earth, in rad/s
    final double lod = (eopHistory == null) ? 0.0 : eopHistory.getLOD(date);
    final double omp = AVE * (1 - lod / Constants.JULIAN_DAY);
    final Vector3D rotationRate = new Vector3D(omp, Vector3D.PLUS_K);

    // set up the transform from parent TOD
    return new Transform(date, new Rotation(Vector3D.PLUS_K, -gast), rotationRate);

}

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

@Test
public void testAASReferenceLEO() throws OrekitException {

    // this reference test has been extracted from the following paper:
    // Implementation Issues Surrounding the New IAU Reference Systems for Astrodynamics
    // David A. Vallado, John H. Seago, P. Kenneth Seidelmann
    // http://www.centerforspace.com/downloads/files/pubs/AAS-06-134.pdf
    Utils.setLoaders(IERSConventions.IERS_1996, Utils.buildEOPList(IERSConventions.IERS_1996, new double[][] {
            { 53098, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53099, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53100, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53101, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53102, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53103, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53104, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN, Double.NaN },
            { 53105, -0.4399619, 0.0015563, -0.140682, 0.333309, -0.052195, -0.003875, Double.NaN,
                    Double.NaN } }));
    AbsoluteDate t0 = new AbsoluteDate(new DateComponents(2004, 04, 06), new TimeComponents(07, 51, 28.386009),
            TimeScalesFactory.getUTC());

    // PEF iau76/*from   w ww.  j  a  v  a 2s  .co m*/
    PVCoordinates pvPEF = new PVCoordinates(new Vector3D(-1033475.0313, 7901305.5856, 6380344.5328),
            new Vector3D(-3225.632747, -2872.442511, 5531.931288));

    // it seems the induced effect of pole nutation correction  on the equation of the equinoxes
    // was not taken into account in the reference paper, so we fix it here for the test
    final double dDeltaPsi = FramesFactory.getEOPHistory(IERSConventions.IERS_1996, true)
            .getEquinoxNutationCorrection(t0)[0];
    final double epsilonA = IERSConventions.IERS_1996.getMeanObliquityFunction().value(t0);
    final Transform fix = new Transform(t0, new Rotation(Vector3D.PLUS_K, -dDeltaPsi * FastMath.cos(epsilonA)));

    // TOD iau76
    PVCoordinates pvTOD = new PVCoordinates(new Vector3D(5094514.7804, 6127366.4612, 6380344.5328),
            new Vector3D(-4746.088567, 786.077222, 5531.931288));

    Transform t = FramesFactory.getTOD(IERSConventions.IERS_1996, true)
            .getTransformTo(FramesFactory.getGTOD(IERSConventions.IERS_1996, true), t0);
    checkPV(fix.transformPVCoordinates(pvPEF), t.transformPVCoordinates(pvTOD), 0.00942, 3.12e-5);

    // if we forget to apply nutation corrections, results are much worse, which is expected
    t = FramesFactory.getTOD(false).getTransformTo(FramesFactory.getGTOD(false), t0);
    checkPV(fix.transformPVCoordinates(pvPEF), t.transformPVCoordinates(pvTOD), 257.49, 0.13955);

}

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

@Test
public void testAASReferenceGEO() throws OrekitException {

    // this reference test has been extracted from the following paper:
    // Implementation Issues Surrounding the New IAU Reference Systems for Astrodynamics
    // David A. Vallado, John H. Seago, P. Kenneth Seidelmann
    // http://www.centerforspace.com/downloads/files/pubs/AAS-06-134.pdf
    Utils.setLoaders(IERSConventions.IERS_1996, Utils.buildEOPList(IERSConventions.IERS_1996, new double[][] {
            { 53153, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53154, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53155, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53156, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53157, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53158, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53159, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN, Double.NaN },
            { 53160, -0.4709050, 0.0000000, -0.083853, 0.467217, -0.053614, -0.004494, Double.NaN,
                    Double.NaN } }));
    AbsoluteDate t0 = new AbsoluteDate(new DateComponents(2004, 06, 01), TimeComponents.H00,
            TimeScalesFactory.getUTC());

    Transform t = FramesFactory.getTOD(IERSConventions.IERS_1996, true)
            .getTransformTo(FramesFactory.getGTOD(IERSConventions.IERS_1996, true), t0);
    // TOD iau76//  w  w w.  j a  v  a2  s .c  o  m
    PVCoordinates pvTOD = new PVCoordinates(new Vector3D(-40577427.7501, -11500096.1306, 10293.2583),
            new Vector3D(837.552338, -2957.524176, -0.928772));

    // PEF iau76
    PVCoordinates pvPEF = new PVCoordinates(new Vector3D(24796919.2956, -34115870.9001, 10293.2583),
            new Vector3D(-0.979178, -1.476540, -0.928772));

    // it seems the induced effect of pole nutation correction  on the equation of the equinoxes
    // was not taken into account in the reference paper, so we fix it here for the test
    final double dDeltaPsi = FramesFactory.getEOPHistory(IERSConventions.IERS_1996, true)
            .getEquinoxNutationCorrection(t0)[0];
    final double epsilonA = IERSConventions.IERS_1996.getMeanObliquityFunction().value(t0);
    final Transform fix = new Transform(t0, new Rotation(Vector3D.PLUS_K, -dDeltaPsi * FastMath.cos(epsilonA)));

    checkPV(fix.transformPVCoordinates(pvPEF), t.transformPVCoordinates(pvTOD), 0.0503, 3.59e-4);

    // if we forget to apply nutation corrections, results are much worse, which is expected
    t = FramesFactory.getTOD(false).getTransformTo(FramesFactory.getGTOD(false), t0);
    checkPV(fix.transformPVCoordinates(pvPEF), t.transformPVCoordinates(pvTOD), 1458.27, 3.847e-4);

}

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//from   w w w  . jav  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);

}