Example usage for org.apache.commons.math3.geometry.euclidean.threed Vector3D MINUS_K

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

Introduction

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

Prototype

Vector3D MINUS_K

To view the source code for org.apache.commons.math3.geometry.euclidean.threed Vector3D MINUS_K.

Click Source Link

Document

Opposite of the third canonical vector (coordinates: 0, 0, -1).

Usage

From source file:org.orekit.utils.TimeStampedAngularCoordinatesTest.java

@Test
public void testInterpolationNeedOffsetWrongRate() throws OrekitException {
    AbsoluteDate date = AbsoluteDate.GALILEO_EPOCH;
    double omega = 2.0 * FastMath.PI;
    TimeStampedAngularCoordinates reference = new TimeStampedAngularCoordinates(date, Rotation.IDENTITY,
            new Vector3D(omega, Vector3D.MINUS_K), Vector3D.ZERO);

    List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>();
    for (double dt : new double[] { 0.0, 0.25, 0.5, 0.75, 1.0 }) {
        TimeStampedAngularCoordinates shifted = reference.shiftedBy(dt);
        sample.add(new TimeStampedAngularCoordinates(shifted.getDate(), shifted.getRotation(), Vector3D.ZERO,
                Vector3D.ZERO));//from   w  w w.j av a 2s . c  om
    }

    for (TimeStampedAngularCoordinates s : sample) {
        TimeStampedAngularCoordinates interpolated = TimeStampedAngularCoordinates.interpolate(s.getDate(),
                AngularDerivativesFilter.USE_RR, sample);
        Rotation r = interpolated.getRotation();
        Vector3D rate = interpolated.getRotationRate();
        Assert.assertEquals(0.0, Rotation.distance(s.getRotation(), r), 2.0e-14);
        Assert.assertEquals(0.0, Vector3D.distance(s.getRotationRate(), rate), 2.0e-13);
    }

}

From source file:org.orekit.utils.TimeStampedAngularCoordinatesTest.java

@Test
public void testInterpolationRotationOnly() throws OrekitException {
    AbsoluteDate date = AbsoluteDate.GALILEO_EPOCH;
    double alpha0 = 0.5 * FastMath.PI;
    double omega = 0.5 * FastMath.PI;
    TimeStampedAngularCoordinates reference = new TimeStampedAngularCoordinates(date,
            new Rotation(Vector3D.PLUS_K, alpha0), new Vector3D(omega, Vector3D.MINUS_K), Vector3D.ZERO);

    List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>();
    for (double dt : new double[] { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }) {
        Rotation r = reference.shiftedBy(dt).getRotation();
        sample.add(new TimeStampedAngularCoordinates(date.shiftedBy(dt), r, Vector3D.ZERO, Vector3D.ZERO));
    }// www  .  j a  v  a2 s  . com

    for (double dt = 0; dt < 1.0; dt += 0.001) {
        TimeStampedAngularCoordinates interpolated = TimeStampedAngularCoordinates
                .interpolate(date.shiftedBy(dt), AngularDerivativesFilter.USE_R, sample);
        Rotation r = interpolated.getRotation();
        Vector3D rate = interpolated.getRotationRate();
        Assert.assertEquals(0.0, Rotation.distance(reference.shiftedBy(dt).getRotation(), r), 3.0e-4);
        Assert.assertEquals(0.0, Vector3D.distance(reference.shiftedBy(dt).getRotationRate(), rate), 1.0e-2);
    }

}

From source file:org.orekit.utils.TimeStampedAngularCoordinatesTest.java

@Test
public void testInterpolationTooSmallSample() throws OrekitException {
    AbsoluteDate date = AbsoluteDate.GALILEO_EPOCH;
    double alpha0 = 0.5 * FastMath.PI;
    double omega = 0.5 * FastMath.PI;
    TimeStampedAngularCoordinates reference = new TimeStampedAngularCoordinates(date,
            new Rotation(Vector3D.PLUS_K, alpha0), new Vector3D(omega, Vector3D.MINUS_K), Vector3D.ZERO);

    List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>();
    Rotation r = reference.shiftedBy(0.2).getRotation();
    sample.add(new TimeStampedAngularCoordinates(date.shiftedBy(0.2), r, Vector3D.ZERO, Vector3D.ZERO));

    try {//from   ww w .  j a va2 s.  c om
        TimeStampedAngularCoordinates.interpolate(date.shiftedBy(0.3), AngularDerivativesFilter.USE_R, sample);
        Assert.fail("an exception should have been thrown");
    } catch (OrekitException oe) {
        Assert.assertEquals(OrekitMessages.NOT_ENOUGH_DATA_FOR_INTERPOLATION, oe.getSpecifier());
        Assert.assertEquals(1, ((Integer) oe.getParts()[0]).intValue());
    }

}