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

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

Introduction

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

Prototype

Vector3D PLUS_K

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

Click Source Link

Document

Third canonical vector (coordinates: 0, 0, 1).

Usage

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

@Test
public void testInterpolationWithoutAcceleration() throws OrekitException {
    AbsoluteDate date = AbsoluteDate.GALILEO_EPOCH;
    double alpha0 = 0.5 * FastMath.PI;
    double omega = 0.05 * FastMath.PI;
    final TimeStampedAngularCoordinates reference = new TimeStampedAngularCoordinates(date,
            new Rotation(Vector3D.PLUS_K, alpha0), new Vector3D(omega, Vector3D.MINUS_K), Vector3D.ZERO);
    double[] errors = interpolationErrors(reference, 1.0);
    Assert.assertEquals(0.0, errors[0], 1.0e-15);
    Assert.assertEquals(0.0, errors[1], 3.0e-15);
    Assert.assertEquals(0.0, errors[2], 3.0e-14);
}

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

@Test
public void testInterpolationWithAcceleration() throws OrekitException {
    AbsoluteDate date = AbsoluteDate.GALILEO_EPOCH;
    double alpha0 = 0.5 * FastMath.PI;
    double omega = 0.05 * FastMath.PI;
    double eta = 0.005 * FastMath.PI;
    final TimeStampedAngularCoordinates reference = new TimeStampedAngularCoordinates(date,
            new Rotation(Vector3D.PLUS_K, alpha0), new Vector3D(omega, Vector3D.MINUS_K),
            new Vector3D(eta, Vector3D.PLUS_J));
    double[] errors = interpolationErrors(reference, 1.0);
    Assert.assertEquals(0.0, errors[0], 3.0e-5);
    Assert.assertEquals(0.0, errors[1], 2.0e-4);
    Assert.assertEquals(0.0, errors[2], 4.6e-3);
}

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));
    }//from   w  ww . j a  va 2  s.c  o  m

    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   w  ww.j  a v  a  2  s  .com
        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());
    }

}

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

@Test
public void testInterpolationGTODIssue() throws OrekitException {
    AbsoluteDate t0 = new AbsoluteDate("2004-04-06T19:59:28.000", TimeScalesFactory.getTAI());
    double[][] params = new double[][] {
            { 0.0, -0.3802356750911964, -0.9248896320037013, 7.292115030462892e-5 },
            { 4.0, 0.1345716955788532, -0.990903859488413, 7.292115033301528e-5 },
            { 8.0, -0.613127541102373, 0.7899839354960061, 7.292115037371062e-5 } };
    List<TimeStampedAngularCoordinates> sample = new ArrayList<TimeStampedAngularCoordinates>();
    for (double[] row : params) {
        AbsoluteDate t = t0.shiftedBy(row[0] * 3600.0);
        Rotation r = new Rotation(row[1], 0.0, 0.0, row[2], false);
        Vector3D o = new Vector3D(row[3], Vector3D.PLUS_K);
        sample.add(new TimeStampedAngularCoordinates(t, r, o, Vector3D.ZERO));
    }//  w w  w. j av  a 2  s .c o  m
    for (double dt = 0; dt < 29000; dt += 120) {
        TimeStampedAngularCoordinates shifted = sample.get(0).shiftedBy(dt);
        TimeStampedAngularCoordinates interpolated = TimeStampedAngularCoordinates.interpolate(t0.shiftedBy(dt),
                AngularDerivativesFilter.USE_RR, sample);
        Assert.assertEquals(0.0, Rotation.distance(shifted.getRotation(), interpolated.getRotation()), 1.3e-7);
        Assert.assertEquals(0.0, Vector3D.distance(shifted.getRotationRate(), interpolated.getRotationRate()),
                1.0e-11);
    }

}