Search in sources :

Example 11 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.

the class FieldAngularCoordinatesTest method testConversionConstructor.

@Test
public void testConversionConstructor() {
    AngularCoordinates ac = new AngularCoordinates(new Rotation(Vector3D.MINUS_J, 0.15, RotationConvention.VECTOR_OPERATOR), new Vector3D(0.001, 0.002, 0.003), new Vector3D(-1.0e-6, -3.0e-6, 7.0e-6));
    FieldAngularCoordinates<Decimal64> ac64 = new FieldAngularCoordinates<>(Decimal64Field.getInstance(), ac);
    Assert.assertEquals(0.0, Rotation.distance(ac.getRotation(), ac64.getRotation().toRotation()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(ac.getRotationRate(), ac64.getRotationRate().toVector3D()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(ac.getRotationAcceleration(), ac64.getRotationAcceleration().toVector3D()), 1.0e-15);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Decimal64(org.hipparchus.util.Decimal64) FieldRotation(org.hipparchus.geometry.euclidean.threed.FieldRotation) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 12 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.

the class TimeStampedAngularCoordinatesTest method testDerivativesStructures2.

@Test
public void testDerivativesStructures2() throws OrekitException {
    RandomGenerator random = new Well1024a(0x75fbebbdbf127b3dl);
    Rotation r = randomRotation(random);
    Vector3D o = randomVector(random, 1.0e-2);
    Vector3D oDot = randomVector(random, 1.0e-2);
    TimeStampedAngularCoordinates ac = new TimeStampedAngularCoordinates(AbsoluteDate.J2000_EPOCH, r, o, oDot);
    TimeStampedAngularCoordinates rebuilt = new TimeStampedAngularCoordinates(AbsoluteDate.J2000_EPOCH, ac.toDerivativeStructureRotation(2));
    Assert.assertEquals(0.0, Rotation.distance(ac.getRotation(), rebuilt.getRotation()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(ac.getRotationRate(), rebuilt.getRotationRate()), 1.0e-15);
    Assert.assertEquals(0.0, Vector3D.distance(ac.getRotationAcceleration(), rebuilt.getRotationAcceleration()), 1.0e-15);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) RandomGenerator(org.hipparchus.random.RandomGenerator) Well1024a(org.hipparchus.random.Well1024a) Test(org.junit.Test)

Example 13 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.

the class TimeStampedAngularCoordinatesTest method testInterpolationRotationOnly.

@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, RotationConvention.VECTOR_OPERATOR), 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));
    }
    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);
    }
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) ArrayList(java.util.ArrayList) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 14 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.

the class TimeStampedAngularCoordinatesTest method testZeroRate.

@Test
public void testZeroRate() throws OrekitException {
    TimeStampedAngularCoordinates ac = new TimeStampedAngularCoordinates(AbsoluteDate.J2000_EPOCH, new Rotation(0.48, 0.64, 0.36, 0.48, false), Vector3D.ZERO, Vector3D.ZERO);
    Assert.assertEquals(Vector3D.ZERO, ac.getRotationRate());
    double dt = 10.0;
    TimeStampedAngularCoordinates shifted = ac.shiftedBy(dt);
    Assert.assertEquals(Vector3D.ZERO, shifted.getRotationAcceleration());
    Assert.assertEquals(Vector3D.ZERO, shifted.getRotationRate());
    Assert.assertEquals(0.0, Rotation.distance(ac.getRotation(), shifted.getRotation()), 1.0e-15);
}
Also used : Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) Test(org.junit.Test)

Example 15 with Rotation

use of org.hipparchus.geometry.euclidean.threed.Rotation in project Orekit by CS-SI.

the class TimeStampedAngularCoordinatesTest method testRoundTripNoOp.

@Test
public void testRoundTripNoOp() {
    RandomGenerator random = new Well1024a(0x1e610cfe89306669l);
    for (int i = 0; i < 100; ++i) {
        Rotation r1 = randomRotation(random);
        Vector3D o1 = randomVector(random, 1.0e-2);
        Vector3D a1 = randomVector(random, 1.0e-2);
        TimeStampedAngularCoordinates ac1 = new TimeStampedAngularCoordinates(AbsoluteDate.J2000_EPOCH, r1, o1, a1);
        Rotation r2 = randomRotation(random);
        Vector3D o2 = randomVector(random, 1.0e-2);
        Vector3D a2 = randomVector(random, 1.0e-2);
        TimeStampedAngularCoordinates ac2 = new TimeStampedAngularCoordinates(AbsoluteDate.J2000_EPOCH, r2, o2, a2);
        TimeStampedAngularCoordinates roundTripSA = ac1.subtractOffset(ac2).addOffset(ac2);
        Assert.assertEquals(0.0, Rotation.distance(ac1.getRotation(), roundTripSA.getRotation()), 4.0e-16);
        Assert.assertEquals(0.0, Vector3D.distance(ac1.getRotationRate(), roundTripSA.getRotationRate()), 2.0e-17);
        Assert.assertEquals(0.0, Vector3D.distance(ac1.getRotationAcceleration(), roundTripSA.getRotationAcceleration()), 1.0e-17);
        TimeStampedAngularCoordinates roundTripAS = ac1.addOffset(ac2).subtractOffset(ac2);
        Assert.assertEquals(0.0, Rotation.distance(ac1.getRotation(), roundTripAS.getRotation()), 6.0e-16);
        Assert.assertEquals(0.0, Vector3D.distance(ac1.getRotationRate(), roundTripAS.getRotationRate()), 2.0e-17);
        Assert.assertEquals(0.0, Vector3D.distance(ac1.getRotationAcceleration(), roundTripAS.getRotationAcceleration()), 2.0e-17);
    }
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) Rotation(org.hipparchus.geometry.euclidean.threed.Rotation) RandomGenerator(org.hipparchus.random.RandomGenerator) Well1024a(org.hipparchus.random.Well1024a) Test(org.junit.Test)

Aggregations

Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)145 Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)116 Test (org.junit.Test)100 AbsoluteDate (org.orekit.time.AbsoluteDate)55 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)53 FieldRotation (org.hipparchus.geometry.euclidean.threed.FieldRotation)43 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)38 PVCoordinates (org.orekit.utils.PVCoordinates)30 SpacecraftState (org.orekit.propagation.SpacecraftState)26 DateComponents (org.orekit.time.DateComponents)22 Frame (org.orekit.frames.Frame)21 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)21 RandomGenerator (org.hipparchus.random.RandomGenerator)19 Transform (org.orekit.frames.Transform)19 FieldPVCoordinates (org.orekit.utils.FieldPVCoordinates)19 CircularOrbit (org.orekit.orbits.CircularOrbit)18 TimeComponents (org.orekit.time.TimeComponents)17 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)16 GeodeticPoint (org.orekit.bodies.GeodeticPoint)15 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)14