Example usage for org.apache.commons.math.geometry Rotation Rotation

List of usage examples for org.apache.commons.math.geometry Rotation Rotation

Introduction

In this page you can find the example usage for org.apache.commons.math.geometry Rotation Rotation.

Prototype

public Rotation(Vector3D u, Vector3D v) 

Source Link

Document

Build one of the rotations that transform one vector into another one.

Usage

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

/** Simple constructor.
 * @param name name of the frame// w  w w.  j  a v a2 s  . co  m
 */
protected EME2000Frame(final String name) {

    super(FramesFactory.getGCRF(), null, name, true);

    // build the bias transform
    final Rotation r1 = new Rotation(Vector3D.PLUS_I, D_EPSILON_B);
    final Rotation r2 = new Rotation(Vector3D.PLUS_J, -D_PSI_B * Math.sin(EPSILON_0));
    final Rotation r3 = new Rotation(Vector3D.PLUS_K, -ALPHA_0);
    final Rotation bias = r1.applyTo(r2.applyTo(r3));

    // store the bias transform
    setTransform(new Transform(bias));

}

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

/** Update the frame to the given date.
 * <p>The update considers the pole motion from IERS data.</p>
 * @param date new value of the date/*from   w ww  .j av a  2 s . co  m*/
 * @exception OrekitException if the nutation model data embedded in the
 * library cannot be read
 */
protected void updateFrame(final AbsoluteDate date) throws OrekitException {

    if ((cachedDate == null) || !cachedDate.equals(date)) {

        // 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 pCorr = ((TIRF2000Frame) getParent()).getPoleCorrection(date);
        final PoleCorrection nCorr = nutationCorrection(date);

        // elementary rotations due to pole motion in terrestrial frame
        final Rotation r1 = new Rotation(Vector3D.PLUS_I, -(pCorr.getYp() + nCorr.getYp()));
        final Rotation r2 = new Rotation(Vector3D.PLUS_J, -(pCorr.getXp() + nCorr.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
        setTransform(new Transform(combined, Vector3D.ZERO));
        cachedDate = date;

    }
}

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

/** Update the frame to the given date.
 * <p>The update considers the precession effects.</p>
 * @param date new value of the date/* w w w  .j  ava2  s  .c  o m*/
 */
protected void updateFrame(final AbsoluteDate date) {

    if ((cachedDate == null) || !cachedDate.equals(date)) {

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

        // compute the zeta precession angle
        final double zeta = ((ZETA_3 * ttc + ZETA_2) * ttc + ZETA_1) * ttc;

        // compute the theta precession angle
        final double theta = ((THETA_3 * ttc + THETA_2) * ttc + THETA_1) * ttc;

        // compute the z precession angle
        final double z = ((Z_3 * ttc + Z_2) * ttc + Z_1) * ttc;

        // elementary rotations for precession
        final Rotation r1 = new Rotation(Vector3D.PLUS_K, z);
        final Rotation r2 = new Rotation(Vector3D.PLUS_J, -theta);
        final Rotation r3 = new Rotation(Vector3D.PLUS_K, zeta);

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

        // set up the transform from parent GCRF
        setTransform(new Transform(precession));

        cachedDate = date;
    }

}

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

/** Update the frame to the given date.
 * <p>The update considers the earth rotation from IERS data.</p>
 * @param date new value of the date/*w w  w.jav  a2s.  com*/
 * @exception OrekitException if the nutation model data embedded in the
 * library cannot be read
 */
protected void updateFrame(final AbsoluteDate date) throws OrekitException {

    if ((cachedDate == null) || !cachedDate.equals(date)) {

        // offset from J2000.0 epoch
        final double tts = date.durationFrom(AbsoluteDate.J2000_EPOCH);

        // evaluate the nutation elements
        setInterpolatedNutationElements(tts);

        // offset from J2000 epoch in julian centuries
        final double ttc = tts / Constants.JULIAN_CENTURY;

        // compute the mean obliquity of the ecliptic
        moe = ((MOE_3 * ttc + MOE_2) * ttc + MOE_1) * ttc + MOE_0;

        final double eqe = getNewEquationOfEquinoxes(date, ttc);

        // offset in julian centuries from J2000 epoch (UT1 scale)
        final double dtai = date.durationFrom(GMST_REFERENCE);
        final double dutc = TimeScalesFactory.getUTC().offsetFromTAI(date);
        final double dut1 = eopHistory.getUT1MinusUTC(date);

        final double tut1 = dtai + dutc + dut1;
        final double tt = tut1 / Constants.JULIAN_CENTURY;

        // Seconds in the day, adjusted by 12 hours because the
        // UT1 is supplied as a Julian date beginning at noon.
        final double sd = (tut1 + Constants.JULIAN_DAY / 2.) % Constants.JULIAN_DAY;

        // compute Greenwich mean sidereal time, in radians
        final double gmst = (((GMST_3 * tt + GMST_2) * tt + GMST_1) * tt + GMST_0 + sd) * RADIANS_PER_SECOND;

        // compute Greenwich apparent sidereal time, in radians
        final double gast = gmst + eqe;

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

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

        cachedDate = date;

    }
}

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

/** Update the frame to the given date.
 * <p>The update considers the nutation effects from IERS data.</p>
 * @param date new value of the date/*from   ww w . j av a 2  s. c om*/
 * @exception OrekitException if the nutation model data embedded in the
 * library cannot be read
 */
protected void updateFrame(final AbsoluteDate date) throws OrekitException {

    if ((cachedDate == null) || !cachedDate.equals(date)) {

        // offset from J2000.0 epoch
        final double tts = date.durationFrom(AbsoluteDate.J2000_EPOCH);

        // evaluate the nutation elements
        setInterpolatedNutationElements(tts);

        // offset from J2000 epoch in julian centuries
        final double ttc = tts / Constants.JULIAN_CENTURY;

        // compute the mean obliquity of the ecliptic
        moe = ((MOE_3 * ttc + MOE_2) * ttc + MOE_1) * ttc + MOE_0;

        // get the IAU1980 corrections for the nutation parameters
        final NutationCorrection nutCorr = (eopHistory == null) ? NutationCorrection.NULL_CORRECTION
                : eopHistory.getNutationCorrection(date);

        final double deps = depsCurrent + nutCorr.getDdeps();
        final double dpsi = dpsiCurrent + nutCorr.getDdpsi();

        // 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 precession = r1.applyTo(r2.applyTo(r3));

        // set up the transform from parent MEME
        setTransform(new Transform(precession));

        cachedDate = date;

    }

}

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

/** Update the frame to the given date.
 * <p>The update considers the earth rotation from IERS data.</p>
 * @param date new value of the date/*from   www .  j  a va2s .  co m*/
 * @exception OrekitException if the nutation model data embedded in the
 * library cannot be read
 */
protected void updateFrame(final AbsoluteDate date) throws OrekitException {

    if ((cachedDate == null) || !cachedDate.equals(date)) {

        // compute Earth Rotation Angle using Nicole Capitaine model (2000)
        final double tidalDtu1 = (tidalCorrection == null) ? 0 : tidalCorrection.getDUT1(date);
        final double dtu1 = eopHistory.getUT1MinusUTC(date);
        final double utcMinusTai = TimeScalesFactory.getUTC().offsetFromTAI(date);
        final double tu = (date.durationFrom(ERA_REFERENCE) + utcMinusTai + dtu1 + tidalDtu1)
                / Constants.JULIAN_DAY;
        era = ERA_0 + ERA_1A * tu + ERA_1B * tu;
        era -= TWO_PI * Math.floor((era + Math.PI) / TWO_PI);

        // set up the transform from parent CIRF
        final Vector3D rotationRate = new Vector3D((ERA_1A + ERA_1B) / Constants.JULIAN_DAY, Vector3D.PLUS_K);
        setTransform(new Transform(new Rotation(Vector3D.PLUS_K, -era), rotationRate));
        cachedDate = date;

    }
}

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

/** Update the frame to the given date.
 * @param date new value of the date/*from   ww w  . jav a2s  .  c o m*/
 * @exception OrekitException if data embedded in the library cannot be read
 */
protected void updateFrame(final AbsoluteDate date) throws OrekitException {

    if ((cachedDate == null) || !cachedDate.equals(date)) {

        // offset from FIFTIES epoch (UT1 scale)
        final double dtai = date.durationFrom(VST_REFERENCE);
        final double dutc = TimeScalesFactory.getUTC().offsetFromTAI(date);
        final double dut1 = eopHistory.getUT1MinusUTC(date);

        final double tut1 = dtai + dutc + dut1;
        final double ttd = tut1 / Constants.JULIAN_DAY;
        final double rdtt = ttd - (int) ttd;

        // compute Veis sidereal time, in radians
        final double vst = (VST0 + VST1 * ttd + TWO_PI * rdtt) % TWO_PI;

        // compute angular rotation of Earth, in rad/s
        final Vector3D rotationRate = new Vector3D(-VSTD, Vector3D.PLUS_K);

        // set up the transform from parent PEF
        setTransform(new Transform(new Rotation(Vector3D.PLUS_K, vst), rotationRate));

        cachedDate = date;
    }

}

From source file:org.orekit.propagation.Ephemeris.java

/** Get the interpolated Attitude.
 * @param date interpolation date//from   w  w w  . j  a  v a 2s  . c o  m
 * @param tp time in seconds since previous date
 * @param tn time in seconds until next date
 * @return the new attitude kinematics
 */
private Attitude interpolatedAttitude(final AbsoluteDate date, final double tp, final double tn) {

    final double dt = tp + tn;

    final Transform prevToNext = new Transform(new Transform(previous.getAttitude().getRotation().revert()),
            new Transform(next.getAttitude().getRotation()));

    final Rotation newRot = new Rotation(prevToNext.getRotation().getAxis(),
            tp * prevToNext.getRotation().getAngle() / dt);
    Vector3D newInstRotAxis;
    if (prevToNext.getRotationRate().getNorm() != 0) {
        newInstRotAxis = new Vector3D(tp * prevToNext.getRotationRate().getNorm() / dt,
                prevToNext.getRotationRate().normalize());
    } else {
        newInstRotAxis = Vector3D.ZERO;
    }

    final Transform newTrans = new Transform(new Transform(previous.getAttitude().getRotation()),
            new Transform(newRot, newInstRotAxis));

    return new Attitude(date, previous.getFrame(), newTrans.getRotation(), newTrans.getRotationRate());

}