Search in sources :

Example 81 with Vector3D

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

the class TimeStampedPVCoordinatesTest method testPVCoordinatesCopyConstructor.

@Test
public void testPVCoordinatesCopyConstructor() {
    // setup
    AbsoluteDate date = AbsoluteDate.J2000_EPOCH;
    PVCoordinates pv = new PVCoordinates(new Vector3D(1, 2, 3), new Vector3D(4, 5, 6));
    // action
    TimeStampedPVCoordinates actual = new TimeStampedPVCoordinates(date, pv);
    // verify
    Assert.assertEquals(date, actual.getDate());
    Assert.assertEquals(1, actual.getPosition().getX(), 0);
    Assert.assertEquals(2, actual.getPosition().getY(), 0);
    Assert.assertEquals(3, actual.getPosition().getZ(), 0);
    Assert.assertEquals(4, actual.getVelocity().getX(), 0);
    Assert.assertEquals(5, actual.getVelocity().getY(), 0);
    Assert.assertEquals(6, actual.getVelocity().getZ(), 0);
    Assert.assertEquals(Vector3D.ZERO, actual.getAcceleration());
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 82 with Vector3D

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

the class TimeStampedPVCoordinatesTest method testInterpolatePolynomialPVA.

@Test
public void testInterpolatePolynomialPVA() {
    Random random = new Random(0xfe3945fcb8bf47cel);
    AbsoluteDate t0 = AbsoluteDate.J2000_EPOCH;
    for (int i = 0; i < 20; ++i) {
        PolynomialFunction px = randomPolynomial(5, random);
        PolynomialFunction py = randomPolynomial(5, random);
        PolynomialFunction pz = randomPolynomial(5, random);
        PolynomialFunction pxDot = px.polynomialDerivative();
        PolynomialFunction pyDot = py.polynomialDerivative();
        PolynomialFunction pzDot = pz.polynomialDerivative();
        PolynomialFunction pxDotDot = pxDot.polynomialDerivative();
        PolynomialFunction pyDotDot = pyDot.polynomialDerivative();
        PolynomialFunction pzDotDot = pzDot.polynomialDerivative();
        List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>();
        for (double dt : new double[] { 0.0, 0.5, 1.0 }) {
            Vector3D position = new Vector3D(px.value(dt), py.value(dt), pz.value(dt));
            Vector3D velocity = new Vector3D(pxDot.value(dt), pyDot.value(dt), pzDot.value(dt));
            Vector3D acceleration = new Vector3D(pxDotDot.value(dt), pyDotDot.value(dt), pzDotDot.value(dt));
            sample.add(new TimeStampedPVCoordinates(t0.shiftedBy(dt), position, velocity, acceleration));
        }
        for (double dt = 0; dt < 1.0; dt += 0.01) {
            TimeStampedPVCoordinates interpolated = TimeStampedPVCoordinates.interpolate(t0.shiftedBy(dt), CartesianDerivativesFilter.USE_PVA, sample);
            Vector3D p = interpolated.getPosition();
            Vector3D v = interpolated.getVelocity();
            Vector3D a = interpolated.getAcceleration();
            Assert.assertEquals(px.value(dt), p.getX(), 4.0e-16 * p.getNorm());
            Assert.assertEquals(py.value(dt), p.getY(), 4.0e-16 * p.getNorm());
            Assert.assertEquals(pz.value(dt), p.getZ(), 4.0e-16 * p.getNorm());
            Assert.assertEquals(pxDot.value(dt), v.getX(), 9.0e-16 * v.getNorm());
            Assert.assertEquals(pyDot.value(dt), v.getY(), 9.0e-16 * v.getNorm());
            Assert.assertEquals(pzDot.value(dt), v.getZ(), 9.0e-16 * v.getNorm());
            Assert.assertEquals(pxDotDot.value(dt), a.getX(), 9.0e-15 * a.getNorm());
            Assert.assertEquals(pyDotDot.value(dt), a.getY(), 9.0e-15 * a.getNorm());
            Assert.assertEquals(pzDotDot.value(dt), a.getZ(), 9.0e-15 * a.getNorm());
        }
    }
}
Also used : Random(java.util.Random) Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) ArrayList(java.util.ArrayList) PolynomialFunction(org.hipparchus.analysis.polynomials.PolynomialFunction) AbsoluteDate(org.orekit.time.AbsoluteDate) Test(org.junit.Test)

Example 83 with Vector3D

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

the class TimeStampedPVCoordinatesTest method testToString.

@Test
public void testToString() {
    Utils.setDataRoot("regular-data");
    TimeStampedPVCoordinates pv = new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10), new Vector3D(10, 1.0, 100));
    Assert.assertEquals("{2000-01-01T11:58:55.816, P(1.0, 0.1, 10.0), V(-1.0, -0.1, -10.0), A(10.0, 1.0, 100.0)}", pv.toString());
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Test(org.junit.Test)

Example 84 with Vector3D

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

the class TimeStampedPVCoordinatesTest method testLinearConstructors.

@Test
public void testLinearConstructors() {
    TimeStampedPVCoordinates pv1 = new TimeStampedPVCoordinates(AbsoluteDate.CCSDS_EPOCH, new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10), new Vector3D(10, -1.0, -100));
    TimeStampedPVCoordinates pv2 = new TimeStampedPVCoordinates(AbsoluteDate.FIFTIES_EPOCH, new Vector3D(2, 0.2, 20), new Vector3D(-2, -0.2, -20), new Vector3D(20, -2.0, -200));
    TimeStampedPVCoordinates pv3 = new TimeStampedPVCoordinates(AbsoluteDate.GALILEO_EPOCH, new Vector3D(3, 0.3, 30), new Vector3D(-3, -0.3, -30), new Vector3D(30, -3.0, -300));
    TimeStampedPVCoordinates pv4 = new TimeStampedPVCoordinates(AbsoluteDate.JULIAN_EPOCH, new Vector3D(4, 0.4, 40), new Vector3D(-4, -0.4, -40), new Vector3D(40, -4.0, -400));
    checkPV(pv4, new TimeStampedPVCoordinates(AbsoluteDate.JULIAN_EPOCH, 4, pv1), 1.0e-15);
    checkPV(pv2, new TimeStampedPVCoordinates(AbsoluteDate.FIFTIES_EPOCH, pv1, pv3), 1.0e-15);
    checkPV(pv3, new TimeStampedPVCoordinates(AbsoluteDate.GALILEO_EPOCH, 1, pv1, 1, pv2), 1.0e-15);
    checkPV(new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, 2, pv4), new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, 3, pv1, 1, pv2, 1, pv3), 1.0e-15);
    checkPV(new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, 3, pv3), new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, 3, pv1, 1, pv2, 1, pv4), 1.0e-15);
    checkPV(new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, 5, pv4), new TimeStampedPVCoordinates(AbsoluteDate.J2000_EPOCH, 4, pv1, 3, pv2, 2, pv3, 1, pv4), 1.0e-15);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D) FieldVector3D(org.hipparchus.geometry.euclidean.threed.FieldVector3D) Test(org.junit.Test)

Example 85 with Vector3D

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

the class Phasing method meanSolarTime.

/**
 * Compute the mean solar time.
 * @param orbit current orbit
 * @return mean solar time
 * @exception OrekitException if state cannot be converted
 */
private double meanSolarTime(final Orbit orbit) throws OrekitException {
    // compute angle between Sun and spacecraft in the equatorial plane
    final Vector3D position = orbit.getPVCoordinates().getPosition();
    final double time = orbit.getDate().getComponents(TimeScalesFactory.getUTC()).getTime().getSecondsInUTCDay();
    final double theta = gmst.value(orbit.getDate());
    final double sunAlpha = theta + FastMath.PI * (1 - time / (Constants.JULIAN_DAY * 0.5));
    final double dAlpha = MathUtils.normalizeAngle(position.getAlpha() - sunAlpha, 0);
    // convert the angle to solar time
    return 12.0 * (1.0 + dAlpha / FastMath.PI);
}
Also used : Vector3D(org.hipparchus.geometry.euclidean.threed.Vector3D)

Aggregations

Vector3D (org.hipparchus.geometry.euclidean.threed.Vector3D)750 Test (org.junit.Test)466 AbsoluteDate (org.orekit.time.AbsoluteDate)323 PVCoordinates (org.orekit.utils.PVCoordinates)280 FieldVector3D (org.hipparchus.geometry.euclidean.threed.FieldVector3D)259 TimeStampedPVCoordinates (org.orekit.utils.TimeStampedPVCoordinates)187 SpacecraftState (org.orekit.propagation.SpacecraftState)152 FieldAbsoluteDate (org.orekit.time.FieldAbsoluteDate)124 Rotation (org.hipparchus.geometry.euclidean.threed.Rotation)119 Frame (org.orekit.frames.Frame)115 KeplerianOrbit (org.orekit.orbits.KeplerianOrbit)105 Orbit (org.orekit.orbits.Orbit)100 GeodeticPoint (org.orekit.bodies.GeodeticPoint)84 OrekitException (org.orekit.errors.OrekitException)83 CartesianOrbit (org.orekit.orbits.CartesianOrbit)75 EquinoctialOrbit (org.orekit.orbits.EquinoctialOrbit)68 DateComponents (org.orekit.time.DateComponents)67 Transform (org.orekit.frames.Transform)61 OneAxisEllipsoid (org.orekit.bodies.OneAxisEllipsoid)59 CircularOrbit (org.orekit.orbits.CircularOrbit)59