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(double q0, double q1, double q2, double q3, boolean needsNormalization) 

Source Link

Document

Build a rotation from the quaternion coordinates.

Usage

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

/** Update the frame to the given date.
 * <p>The update considers the nutation and precession effects from IERS data.</p>
 * @param date new value of the date/*from ww  w  .ja v  a2s.  co  m*/
 * @exception OrekitException if the nutation model data embedded in the
 * library cannot be read
 */
protected void updateFrame(final AbsoluteDate date) throws OrekitException {

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

    // evaluate pole motion in celestial frame
    setInterpolatedPoleCoordinates(t);

    // set up the bias, precession and nutation rotation
    final double x2Py2 = xCurrent * xCurrent + yCurrent * yCurrent;
    final double zP1 = 1 + Math.sqrt(1 - x2Py2);
    final double r = Math.sqrt(x2Py2);
    final double sPe2 = 0.5 * (sCurrent + Math.atan2(yCurrent, xCurrent));
    final double cos = Math.cos(sPe2);
    final double sin = Math.sin(sPe2);
    final double xPr = xCurrent + r;
    final double xPrCos = xPr * cos;
    final double xPrSin = xPr * sin;
    final double yCos = yCurrent * cos;
    final double ySin = yCurrent * sin;
    final Rotation bpn = new Rotation(zP1 * (xPrCos + ySin), -r * (yCos + xPrSin), r * (xPrCos - ySin),
            zP1 * (yCos - xPrSin), true);

    // set up the transform from parent GCRF
    setTransform(new Transform(bpn, Vector3D.ZERO));

}