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

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

Introduction

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

Prototype

public Rotation applyTo(Rotation r) 

Source Link

Document

Apply the instance to another rotation.

Usage

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

/** Simple constructor.
 * @param name name of the frame//from   ww  w. ja v a 2s .c  o 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/*w w  w . ja v  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.LocalOrbitalFrame.java

/** {@inheritDoc} */
protected void updateFrame(final AbsoluteDate date) throws OrekitException {

    // get position/velocity with respect to parent frame
    final PVCoordinates pv = provider.getPVCoordinates(date, getParent());
    final Vector3D p = pv.getPosition();
    final Vector3D v = pv.getVelocity();
    final Vector3D momentum = pv.getMomentum();

    // compute the translation part of the transform
    final Transform translation = new Transform(p.negate(), v.negate());

    // compute the rotation part of the transform
    final Rotation r = new Rotation((type == LOFType.TNW) ? v : p, momentum, Vector3D.PLUS_I, Vector3D.PLUS_K);
    final Transform rotation = new Transform(r, new Vector3D(1.0 / p.getNormSq(), r.applyTo(momentum)));

    // update the frame defining transform
    setTransform(new Transform(translation, rotation));

}

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  a  v a2 s  . co  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.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   w w  w. ja v  a 2  s.c  o 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.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;

    }

}