Example usage for org.apache.commons.math3.geometry.euclidean.threed RotationOrder ZXY

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

Introduction

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

Prototype

RotationOrder ZXY

To view the source code for org.apache.commons.math3.geometry.euclidean.threed RotationOrder ZXY.

Click Source Link

Document

Set of Cardan angles.

Usage

From source file:org.orekit.attitudes.LofOffsetTest.java

@Test
public void testRetrieveAngles() throws OrekitException, CardanEulerSingularityException {
    AbsoluteDate date = new AbsoluteDate(new DateComponents(1970, 01, 01), new TimeComponents(3, 25, 45.6789),
            TimeScalesFactory.getUTC());
    KeplerianOrbit orbit = new KeplerianOrbit(7178000.0, 1.e-4, FastMath.toRadians(50.),
            FastMath.toRadians(10.), FastMath.toRadians(20.), FastMath.toRadians(30.), PositionAngle.MEAN,
            FramesFactory.getEME2000(), date, 3.986004415e14);

    RotationOrder order = RotationOrder.ZXY;
    double alpha1 = 0.123;
    double alpha2 = 0.456;
    double alpha3 = 0.789;
    LofOffset law = new LofOffset(orbit.getFrame(), LOFType.VVLH, order, alpha1, alpha2, alpha3);
    Rotation offsetAtt = law.getAttitude(orbit, date, orbit.getFrame()).getRotation();
    Rotation alignedAtt = new LofOffset(orbit.getFrame(), LOFType.VVLH)
            .getAttitude(orbit, date, orbit.getFrame()).getRotation();
    Rotation offsetProper = offsetAtt.applyTo(alignedAtt.revert());
    double[] angles = offsetProper.revert().getAngles(order);
    Assert.assertEquals(alpha1, angles[0], 1.0e-11);
    Assert.assertEquals(alpha2, angles[1], 1.0e-11);
    Assert.assertEquals(alpha3, angles[2], 1.0e-11);
}