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.frames.LocalOrbitalFrameTest.java

private void checkFrame(LOFType type, AbsoluteDate date, Vector3D expectedXDirection,
        Vector3D expectedYDirection, Vector3D expectedZDirection, Vector3D expectedRotationDirection)
        throws OrekitException {
    LocalOrbitalFrame lof = new LocalOrbitalFrame(FramesFactory.getGCRF(), type, provider, type.name());

    Transform t = lof.getTransformTo(FramesFactory.getGCRF(), date);
    PVCoordinates pv1 = t.transformPVCoordinates(PVCoordinates.ZERO);
    Vector3D p1 = pv1.getPosition();
    Vector3D v1 = pv1.getVelocity();
    PVCoordinates pv2 = provider.getPVCoordinates(date, FramesFactory.getGCRF());
    Vector3D p2 = pv2.getPosition();
    Vector3D v2 = pv2.getVelocity();
    Assert.assertEquals(0, p1.subtract(p2).getNorm(), 1.0e-14 * p1.getNorm());
    Assert.assertEquals(0, v1.subtract(v2).getNorm(), 1.0e-14 * v1.getNorm());

    Vector3D xDirection = t.transformVector(Vector3D.PLUS_I);
    Vector3D yDirection = t.transformVector(Vector3D.PLUS_J);
    Vector3D zDirection = t.transformVector(Vector3D.PLUS_K);
    Assert.assertEquals(0, Vector3D.angle(expectedXDirection, xDirection), 2.0e-15);
    Assert.assertEquals(0, Vector3D.angle(expectedYDirection, yDirection), 1.0e-15);
    Assert.assertEquals(0, Vector3D.angle(expectedZDirection, zDirection), 1.0e-15);
    Assert.assertEquals(0, Vector3D.angle(expectedRotationDirection, t.getRotationRate()), 1.0e-15);

    Assert.assertEquals(initialOrbit.getKeplerianMeanMotion(), t.getRotationRate().getNorm(), 1.0e-7);

}

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

/** Get the transfrom from parent frame.
 * <p>The update considers the precession effects.</p>
 * @param date new value of the date/*from  ww w . j  av  a  2  s  . co  m*/
 * @return transform at the specified date
 */
public Transform getTransform(final AbsoluteDate date) {

    // compute the precession angles phiA, omegaA, chiA
    final double[] angles = precessionFunction.value(date);

    // elementary rotations for precession
    final Rotation r1 = new Rotation(Vector3D.PLUS_K, -angles[2]);
    final Rotation r2 = new Rotation(Vector3D.PLUS_I, angles[1]);
    final Rotation r3 = new Rotation(Vector3D.PLUS_K, angles[0]);

    // complete precession
    final Rotation precession = r1.applyTo(r2.applyTo(r3.applyTo(r4)));

    // set up the transform from parent GCRF
    return new Transform(date, precession);

}

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

@Test
public void testEuler1976() throws OrekitException {

    TransformProvider eulerBasedProvider = new TransformProvider() {
        private static final long serialVersionUID = 1L;
        private final PolynomialNutation<DerivativeStructure> zetaA = new PolynomialNutation<DerivativeStructure>(
                0.0, 2306.2181 * Constants.ARC_SECONDS_TO_RADIANS, 0.30188 * Constants.ARC_SECONDS_TO_RADIANS,
                0.017998 * Constants.ARC_SECONDS_TO_RADIANS);
        private final PolynomialNutation<DerivativeStructure> thetaA = new PolynomialNutation<DerivativeStructure>(
                0.0, 2004.3109 * Constants.ARC_SECONDS_TO_RADIANS, -0.42665 * Constants.ARC_SECONDS_TO_RADIANS,
                -0.041833 * Constants.ARC_SECONDS_TO_RADIANS);
        private final PolynomialNutation<DerivativeStructure> zA = new PolynomialNutation<DerivativeStructure>(
                0.0, 2306.2181 * Constants.ARC_SECONDS_TO_RADIANS, 1.09468 * Constants.ARC_SECONDS_TO_RADIANS,
                0.018203 * Constants.ARC_SECONDS_TO_RADIANS);

        public Transform getTransform(AbsoluteDate date) {
            final double tc = IERSConventions.IERS_1996.evaluateTC(date);
            final Rotation r1 = new Rotation(Vector3D.PLUS_K, zA.value(tc));
            final Rotation r2 = new Rotation(Vector3D.PLUS_J, -thetaA.value(tc));
            final Rotation r3 = new Rotation(Vector3D.PLUS_K, zetaA.value(tc));
            return new Transform(date, r1.applyTo(r2.applyTo(r3)));
        }//w  w w .j  a va2 s  .c o  m
    };

    MODProvider modProvider = new MODProvider(IERSConventions.IERS_1996);

    for (double dt = -5 * Constants.JULIAN_YEAR; dt < 5 * Constants.JULIAN_YEAR; dt += 10
            * Constants.JULIAN_DAY) {
        AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(dt);
        Transform t = new Transform(date, modProvider.getTransform(date).getInverse(),
                eulerBasedProvider.getTransform(date));
        Assert.assertEquals(0, t.getRotation().getAngle(), 1.01e-11);
    }

}

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

@Test
public void testEuler2000() throws OrekitException {

    // this alternate representation of the transform
    // is from equation 33 in IERS conventions 2003
    TransformProvider eulerBasedProvider = new TransformProvider() {
        private static final long serialVersionUID = 1L;
        private final PolynomialNutation<DerivativeStructure> zetaA = new PolynomialNutation<DerivativeStructure>(
                2.5976176 * Constants.ARC_SECONDS_TO_RADIANS, 2306.0809506 * Constants.ARC_SECONDS_TO_RADIANS,
                0.3019015 * Constants.ARC_SECONDS_TO_RADIANS, 0.0179663 * Constants.ARC_SECONDS_TO_RADIANS,
                -0.0000327 * Constants.ARC_SECONDS_TO_RADIANS, -0.0000002 * Constants.ARC_SECONDS_TO_RADIANS);
        private final PolynomialNutation<DerivativeStructure> thetaA = new PolynomialNutation<DerivativeStructure>(
                0.0, 2004.1917476 * Constants.ARC_SECONDS_TO_RADIANS,
                -0.4269353 * Constants.ARC_SECONDS_TO_RADIANS, -0.0418251 * Constants.ARC_SECONDS_TO_RADIANS,
                -0.0000601 * Constants.ARC_SECONDS_TO_RADIANS, -0.0000001 * Constants.ARC_SECONDS_TO_RADIANS);
        private final PolynomialNutation<DerivativeStructure> zA = new PolynomialNutation<DerivativeStructure>(
                -2.5976176 * Constants.ARC_SECONDS_TO_RADIANS, 2306.0803226 * Constants.ARC_SECONDS_TO_RADIANS,
                1.0947790 * Constants.ARC_SECONDS_TO_RADIANS, 0.0182273 * Constants.ARC_SECONDS_TO_RADIANS,
                0.0000470 * Constants.ARC_SECONDS_TO_RADIANS, -0.0000003 * Constants.ARC_SECONDS_TO_RADIANS);

        public Transform getTransform(AbsoluteDate date) {
            final double tc = IERSConventions.IERS_2003.evaluateTC(date);
            final Rotation r1 = new Rotation(Vector3D.PLUS_K, zA.value(tc));
            final Rotation r2 = new Rotation(Vector3D.PLUS_J, -thetaA.value(tc));
            final Rotation r3 = new Rotation(Vector3D.PLUS_K, zetaA.value(tc));
            return new Transform(date, r1.applyTo(r2.applyTo(r3)));
        }/*w ww .  j  a v a2 s .c  o  m*/
    };

    MODProvider modProvider = new MODProvider(IERSConventions.IERS_2003);

    for (double dt = -Constants.JULIAN_CENTURY; dt < Constants.JULIAN_CENTURY; dt += 50
            * Constants.JULIAN_DAY) {
        AbsoluteDate date = AbsoluteDate.J2000_EPOCH.shiftedBy(dt);
        Transform t = new Transform(date, modProvider.getTransform(date).getInverse(),
                eulerBasedProvider.getTransform(date));
        Assert.assertEquals(0, t.getRotation().getAngle(), 6.6e-13);
    }

}

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

/** Get the transform from True Of Date date.
 * @param date new value of the date/*from  www  .j a  v a2 s .co m*/
 * @return transform at the specified date
 * @exception OrekitException if the nutation model data embedded in the
 * library cannot be read
 */
public synchronized Transform getTransform(final AbsoluteDate date) throws OrekitException {
    final double eqe = getEquationOfEquinoxes(date);
    return new Transform(date, new Rotation(Vector3D.PLUS_K, -eqe));
}

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

/** Get the transform from CIRF 2000 at specified date.
 * <p>The update considers the earth rotation from IERS data.</p>
 * @param date new value of the date//  ww  w . j a v  a  2  s  . com
 * @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 proper rotation
    final double correctedERA = era.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 CIRF2000
    final Rotation rotation = new Rotation(Vector3D.PLUS_K, -correctedERA);
    return new Transform(date, rotation, rotationRate);

}

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

/** Get the transform from Mean Of Date at specified date.
 * <p>The update considers the nutation effects from IERS data.</p>
 * @param date new value of the date//from ww w .j  a v  a 2  s.  co 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 nutation angles
    final double[] angles = nutationFunction.value(date);

    // compute the mean obliquity of the ecliptic
    final double moe = obliquityFunction.value(date);

    double dpsi = angles[0];
    double deps = angles[1];
    if (eopHistory != null) {
        // apply the corrections for the nutation parameters
        final double[] correction = eopHistory.getEquinoxNutationCorrection(date);
        dpsi += correction[0];
        deps += correction[1];
    }

    // compute the true obliquity of the ecliptic
    final double toe = moe + deps;

    // set up the elementary rotations for nutation
    final Rotation r1 = new Rotation(Vector3D.PLUS_I, toe);
    final Rotation r2 = new Rotation(Vector3D.PLUS_K, dpsi);
    final Rotation r3 = new Rotation(Vector3D.PLUS_I, -moe);

    // complete nutation
    final Rotation nutation = r1.applyTo(r2.applyTo(r3));

    // set up the transform from parent MOD
    return new Transform(date, nutation);

}

From source file:org.orekit.frames.TODProviderTest.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());

    Transform tt = FramesFactory.getMOD(IERSConventions.IERS_1996)
            .getTransformTo(FramesFactory.getTOD(IERSConventions.IERS_1996, true), t0);
    Transform ff = FramesFactory.getMOD(false).getTransformTo(FramesFactory.getTOD(false), t0);

    //TOD iau76//  ww w  .j a  v  a2s.  c o m
    PVCoordinates pvTODiau76 = new PVCoordinates(new Vector3D(5094514.7804, 6127366.4612, 6380344.5328),
            new Vector3D(-4746.088567, 786.077222, 5531.931288));
    //MOD iau76
    PVCoordinates pvMODiau76WithoutNutCorr = new PVCoordinates(
            new Vector3D(5094029.0167, 6127870.9363, 6380247.8885),
            new Vector3D(-4746.262495, 786.014149, 5531.791025));
    //MOD iau76
    PVCoordinates pvMODiau76 = new PVCoordinates(new Vector3D(5094028.3745, 6127870.8164, 6380248.5164),
            new Vector3D(-4746.263052, 786.014045, 5531.790562));

    // 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(pvTODiau76, fix.transformPVCoordinates(tt.transformPVCoordinates(pvMODiau76)), 1.13e-3, 5.3e-5);
    checkPV(pvTODiau76, ff.transformPVCoordinates(pvMODiau76WithoutNutCorr), 1.07e-3, 5.3e-5);

}

From source file:org.orekit.frames.TODProviderTest.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 tt = FramesFactory.getMOD(IERSConventions.IERS_1996)
            .getTransformTo(FramesFactory.getTOD(IERSConventions.IERS_1996, true), t0);
    Transform ff = FramesFactory.getMOD(false).getTransformTo(FramesFactory.getTOD(false), t0);

    // TOD iau76//from w  w  w.  j a  v a 2  s  . c om
    PVCoordinates pvTODiau76 = new PVCoordinates(new Vector3D(-40577427.7501, -11500096.1306, 10293.2583),
            new Vector3D(837.552338, -2957.524176, -0.928772));
    // MOD iau76
    PVCoordinates pvMODiau76WithoutNutCorr = new PVCoordinates(
            new Vector3D(-40576822.6385, -11502231.5013, 9738.2304),
            new Vector3D(837.708020, -2957.480118, -0.814275));

    // MOD iau76
    PVCoordinates pvMODiau76 = new PVCoordinates(new Vector3D(-40576822.6395, -11502231.5015, 9733.7842),
            new Vector3D(837.708020, -2957.480117, -0.814253));

    // 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(pvTODiau76, fix.transformPVCoordinates(tt.transformPVCoordinates(pvMODiau76)), 4.86e-4, 6.2e-5);
    checkPV(pvTODiau76, ff.transformPVCoordinates(pvMODiau76WithoutNutCorr), 4.87e-4, 6.31e-5);

}

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

/** Simple constructor.
 * @param parentShape body shape on which the local point is defined
 * @param point local surface point where topocentric frame is defined
 * @param name the string representation
 *//* w  ww.  ja  v a2 s  .  c om*/
public TopocentricFrame(final BodyShape parentShape, final GeodeticPoint point, final String name) {

    super(parentShape.getBodyFrame(),
            new Transform(AbsoluteDate.J2000_EPOCH,
                    new Transform(AbsoluteDate.J2000_EPOCH, parentShape.transform(point).negate()),
                    new Transform(AbsoluteDate.J2000_EPOCH,
                            new Rotation(point.getEast(), point.getZenith(), Vector3D.PLUS_I, Vector3D.PLUS_K),
                            Vector3D.ZERO)),
            name, false);
    this.parentShape = parentShape;
    this.point = point;
}