Example usage for org.apache.commons.math3.geometry.euclidean.threed Rotation Rotation

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

Introduction

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

Prototype

public Rotation(Vector3D u, Vector3D v) throws MathArithmeticException 

Source Link

Document

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

Usage

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

/** Simple constructor.
 *//*from ww w. jav a2s. com*/
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.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//from   www  .  ja v 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 {

    // 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/* www . j a va 2s.  c o 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//from w w  w .j  a v  a  2 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.HelmertTransformation.java

/** Compute the transform at some date.
 * @param date date at which the transform is desired
 * @return computed transform at specified date
 *//*from   w  w  w.j  a  v a2  s  .c  o m*/
public Transform getTransform(final AbsoluteDate date) {

    // compute parameters evolution since reference epoch
    final double dt = date.durationFrom(epoch);
    final Vector3D dR = new Vector3D(1, rotationVector, dt, rotationRate);

    // build translation part
    final Transform translationTransform = new Transform(date, cartesian.shiftedBy(dt));

    // build rotation part
    final double angle = dR.getNorm();
    final Transform rotationTransform = new Transform(date,
            (angle < Precision.SAFE_MIN) ? Rotation.IDENTITY : new Rotation(dR, angle), rotationRate);

    // combine both parts
    return new Transform(date, translationTransform, rotationTransform);

}

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

@Test
public void testSofaCookbook() throws OrekitException {

    // SOFA cookbook test case:
    //     date       2007 April 05, 12h00m00s.0 UTC
    //     xp         +0.0349282
    //     yp         +0.4833163
    //     UT1  UTC  -0s.072073685
    //     d 1980    -0.0550655
    //     d 1980    -0.0063580
    //     dX 2000    +0.0001725
    //     dY 2000    -0.0002650
    //     dX 2006    +0.0001750
    //     dY 2006    -0.0002259

    Utils.setLoaders(IERSConventions.IERS_1996,
            Utils.buildEOPList(IERSConventions.IERS_1996,
                    new double[][] {
                            { 54192, -0.072073685, 1.4020, 0.0349282, 0.4833163, -0.0550666, -0.0063580,
                                    Double.NaN, Double.NaN },
                            { 54193, -0.072073685, 1.4020, 0.0349282, 0.4833163, -0.0550666, -0.0063580,
                                    Double.NaN, Double.NaN },
                            { 54194, -0.072073685, 1.4020, 0.0349282, 0.4833163, -0.0550666, -0.0063580,
                                    Double.NaN, Double.NaN },
                            { 54195, -0.072073685, 1.4020, 0.0349282, 0.4833163, -0.0550666, -0.0063580,
                                    Double.NaN, Double.NaN },
                            { 54196, -0.072073685, 1.4020, 0.0349282, 0.4833163, -0.0550666, -0.0063580,
                                    Double.NaN, Double.NaN },
                            { 54197, -0.072073685, 1.4020, 0.0349282, 0.4833163, -0.0550666, -0.0063580,
                                    Double.NaN, Double.NaN },
                            { 54198, -0.072073685, 1.4020, 0.0349282, 0.4833163, -0.0550666, -0.0063580,
                                    Double.NaN, Double.NaN },
                            { 54199, -0.072073685, 1.4020, 0.0349282, 0.4833163, -0.0550666, -0.0063580,
                                    Double.NaN, Double.NaN } }));

    EOPHistory eopHistory = FramesFactory.getEOPHistory(IERSConventions.IERS_1996, true);

    TimeScale utc = TimeScalesFactory.getUTC();
    TTScale tt = TimeScalesFactory.getTT();
    UT1Scale ut1 = TimeScalesFactory.getUT1(eopHistory);
    Frame gcrf = FramesFactory.getGCRF();
    Frame itrf = FramesFactory.getITRFEquinox(IERSConventions.IERS_1996, true);
    Frame gtod = itrf.getParent();
    Frame tod = gtod.getParent();

    // time scales checks
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2007, 4, 5), TimeComponents.H12, utc);
    Assert.assertEquals(0.50075444444444,
            date.getComponents(tt).getTime().getSecondsInDay() / Constants.JULIAN_DAY, 5.0e-15);
    Assert.assertEquals(0.499999165813831,
            date.getComponents(ut1).getTime().getSecondsInDay() / Constants.JULIAN_DAY, 1.0e-15);

    // sidereal time check
    double gast = IERSConventions.IERS_1996.getGASTFunction(ut1, eopHistory).value(date).getValue();
    Assert.assertEquals(13.412402380740 * 3600 * 1.0e6, radToMicroAS(MathUtils.normalizeAngle(gast, 0)), 25);

    // nutation/precession/bias matrix check
    Rotation refNPB = new Rotation(
            new double[][] { { +0.999998403176203, -0.001639032970562, -0.000712190961847 },
                    { +0.001639000942243, +0.999998655799521, -0.000045552846624 },
                    { +0.000712264667137, +0.000044385492226, +0.999999745354454 } },
            1.0e-13);/*from w  ww. j ava2s.  c om*/
    Rotation npb = gcrf.getTransformTo(tod, date).getRotation();
    Assert.assertEquals(0.0, radToMicroAS(Rotation.distance(refNPB, npb)), 27.0);

    // celestial to terrestrial frames matrix, without polar motion
    Rotation refWithoutPolarMotion = new Rotation(
            new double[][] { { +0.973104317592265, +0.230363826166883, -0.000703332813776 },
                    { -0.230363798723533, +0.973104570754697, +0.000120888299841 },
                    { +0.000712264667137, +0.000044385492226, +0.999999745354454 } },
            1.0e-13);
    Rotation withoutPM = gcrf.getTransformTo(gtod, date).getRotation();
    Assert.assertEquals(0.0, radToMicroAS(Rotation.distance(refWithoutPolarMotion, withoutPM)), 9);

    // celestial to terrestrial frames matrix, with polar motion
    Rotation refWithPolarMotion = new Rotation(
            new double[][] { { +0.973104317712772, +0.230363826174782, -0.000703163477127 },
                    { -0.230363800391868, +0.973104570648022, +0.000118545116892 },
                    { +0.000711560100206, +0.000046626645796, +0.999999745754058 } },
            1.0e-13);
    Rotation withPM = gcrf.getTransformTo(itrf, date).getRotation();
    Assert.assertEquals(0.0, radToMicroAS(Rotation.distance(refWithPolarMotion, withPM)), 10);

}

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.j a v a2  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 {

    // 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);

}

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

@Test
public void testSofaCookbook() throws OrekitException {

    // SOFA cookbook test case:
    //     date       2007 April 05, 12h00m00s.0 UTC
    //     xp         +0.0349282
    //     yp         +0.4833163
    //     UT1  UTC  -0s.072073685
    //     d 1980    -0.0550655
    //     d 1980    -0.0063580
    //     dX 2000    +0.0001725
    //     dY 2000    -0.0002650
    //     dX 2006    +0.0001750
    //     dY 2006    -0.0002259

    Utils.setLoaders(IERSConventions.IERS_2010,
            Utils.buildEOPList(IERSConventions.IERS_2010,
                    new double[][] {
                            { 54192, -0.072073685, 1.4020, 0.0349282, 0.4833163, -Double.NaN, Double.NaN,
                                    0.0001750, -0.0002259 },
                            { 54193, -0.072073685, 1.4020, 0.0349282, 0.4833163, -Double.NaN, Double.NaN,
                                    0.0001750, -0.0002259 },
                            { 54194, -0.072073685, 1.4020, 0.0349282, 0.4833163, -Double.NaN, Double.NaN,
                                    0.0001750, -0.0002259 },
                            { 54195, -0.072073685, 1.4020, 0.0349282, 0.4833163, -Double.NaN, Double.NaN,
                                    0.0001750, -0.0002259 },
                            { 54196, -0.072073685, 1.4020, 0.0349282, 0.4833163, -Double.NaN, Double.NaN,
                                    0.0001750, -0.0002259 },
                            { 54197, -0.072073685, 1.4020, 0.0349282, 0.4833163, -Double.NaN, Double.NaN,
                                    0.0001750, -0.0002259 },
                            { 54198, -0.072073685, 1.4020, 0.0349282, 0.4833163, -Double.NaN, Double.NaN,
                                    0.0001750, -0.0002259 },
                            { 54199, -0.072073685, 1.4020, 0.0349282, 0.4833163, -Double.NaN, Double.NaN,
                                    0.0001750, -0.0002259 } }));

    EOPHistory eopHistory = FramesFactory.getEOPHistory(IERSConventions.IERS_2010, true);

    TimeScale utc = TimeScalesFactory.getUTC();
    TTScale tt = TimeScalesFactory.getTT();
    UT1Scale ut1 = TimeScalesFactory.getUT1(eopHistory);
    Frame gcrf = FramesFactory.getGCRF();
    Frame itrf = FramesFactory.getITRF(IERSConventions.IERS_2010, true);
    Frame gtod = itrf.getParent();
    Frame tod = gtod.getParent();

    // time scales checks
    AbsoluteDate date = new AbsoluteDate(new DateComponents(2007, 4, 5), TimeComponents.H12, utc);
    Assert.assertEquals(0.50075444444444,
            date.getComponents(tt).getTime().getSecondsInDay() / Constants.JULIAN_DAY, 5.0e-15);
    Assert.assertEquals(0.499999165813831,
            date.getComponents(ut1).getTime().getSecondsInDay() / Constants.JULIAN_DAY, 1.0e-15);

    // sidereal time check
    double era = IERSConventions.IERS_2010.getEarthOrientationAngleFunction(ut1).value(date).getValue();
    Assert.assertEquals(13.318492966097 * 3600 * 1.0e6, radToMicroAS(MathUtils.normalizeAngle(era, 0)), 0.0022);

    // nutation/precession/bias matrix check
    Rotation refNPB = new Rotation(
            new double[][] { { +0.999999746339445, -0.000000005138721, -0.000712264730182 },
                    { -0.000000026475329, +0.999999999014975, -0.000044385242666 },
                    { +0.000712264729708, +0.000044385250265, +0.999999745354420 } },
            1.0e-13);//from   w w  w  .  j av a  2 s .co m
    Rotation npb = gcrf.getTransformTo(tod, date).getRotation();
    Assert.assertEquals(0.0, radToMicroAS(Rotation.distance(refNPB, npb)), 0.31);

    // celestial to terrestrial frames matrix, without polar motion
    Rotation refWithoutPolarMotion = new Rotation(
            new double[][] { { +0.973104317573104, +0.230363826247808, -0.000703332818915 },
                    { -0.230363798804281, +0.973104570735550, +0.000120888549767 },
                    { +0.000712264729708, +0.000044385250265, +0.999999745354420 } },
            1.0e-13);
    Rotation withoutPM = gcrf.getTransformTo(gtod, date).getRotation();
    Assert.assertEquals(0.0, radToMicroAS(Rotation.distance(refWithoutPolarMotion, withoutPM)), 0.31);

    // celestial to terrestrial frames matrix, with polar motion
    Rotation refWithPolarMotion = new Rotation(
            new double[][] { { +0.973104317697512, +0.230363826239227, -0.000703163482268 },
                    { -0.230363800456136, +0.973104570632777, +0.000118545366806 },
                    { +0.000711560162777, +0.000046626403835, +0.999999745754024 } },
            1.0e-13);
    Rotation withPM = gcrf.getTransformTo(itrf, date).getRotation();
    Assert.assertEquals(0.0, radToMicroAS(Rotation.distance(refWithPolarMotion, withPM)), 0.31);

}

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

/** Simple constructor.
 * @param conventions IERS conventions to apply
 * @exception OrekitException if IERS conventions tables cannot be read
 *///from   w w  w  .j a v a2s.c  o  m
MODProvider(final IERSConventions conventions) throws OrekitException {
    this.conventions = conventions;
    this.precessionFunction = conventions.getPrecessionFunction();
    final TimeFunction<Double> epsilonAFunction = conventions.getMeanObliquityFunction();
    final AbsoluteDate date0 = conventions.getNutationReferenceEpoch();
    final double epsilon0 = epsilonAFunction.value(date0);
    r4 = new Rotation(Vector3D.PLUS_I, -epsilon0);
}

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  ava2 s. c om*/
 * @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);

}