use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.
the class PVCoordinatesTest method differentiate.
private Vector3D differentiate(CartesianOrbit orbit, OrbitFunction picker) {
try {
HermiteInterpolator interpolator = new HermiteInterpolator();
final double step = 0.01;
for (int i = -4; i < 4; ++i) {
double dt = i * step;
interpolator.addSamplePoint(dt, picker.apply(orbit.shiftedBy(dt)).toArray());
}
return new Vector3D(interpolator.derivatives(0.0, 1)[1]);
} catch (OrekitException oe) {
return null;
}
}
use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.
the class PVCoordinatesTest method testToDerivativeStructurePV2.
@Test
public void testToDerivativeStructurePV2() throws OrekitException {
FieldPVCoordinates<DerivativeStructure> fv = new PVCoordinates(new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10), new Vector3D(10, -1.0, -100)).toDerivativeStructurePV(2);
Assert.assertEquals(1, fv.getPosition().getX().getFreeParameters());
Assert.assertEquals(2, fv.getPosition().getX().getOrder());
Assert.assertEquals(1.0, fv.getPosition().getX().getReal(), 1.0e-10);
Assert.assertEquals(0.1, fv.getPosition().getY().getReal(), 1.0e-10);
Assert.assertEquals(10.0, fv.getPosition().getZ().getReal(), 1.0e-10);
Assert.assertEquals(-1.0, fv.getVelocity().getX().getReal(), 1.0e-10);
Assert.assertEquals(-0.1, fv.getVelocity().getY().getReal(), 1.0e-10);
Assert.assertEquals(-10.0, fv.getVelocity().getZ().getReal(), 1.0e-10);
Assert.assertEquals(10.0, fv.getAcceleration().getX().getReal(), 1.0e-10);
Assert.assertEquals(-1.0, fv.getAcceleration().getY().getReal(), 1.0e-10);
Assert.assertEquals(-100.0, fv.getAcceleration().getZ().getReal(), 1.0e-10);
Assert.assertEquals(fv.getVelocity().getX().getReal(), fv.getPosition().getX().getPartialDerivative(1), 1.0e-10);
Assert.assertEquals(fv.getVelocity().getY().getReal(), fv.getPosition().getY().getPartialDerivative(1), 1.0e-10);
Assert.assertEquals(fv.getVelocity().getZ().getReal(), fv.getPosition().getZ().getPartialDerivative(1), 1.0e-10);
Assert.assertEquals(fv.getAcceleration().getX().getReal(), fv.getPosition().getX().getPartialDerivative(2), 1.0e-10);
Assert.assertEquals(fv.getAcceleration().getY().getReal(), fv.getPosition().getY().getPartialDerivative(2), 1.0e-10);
Assert.assertEquals(fv.getAcceleration().getZ().getReal(), fv.getPosition().getZ().getPartialDerivative(2), 1.0e-10);
Assert.assertEquals(fv.getAcceleration().getX().getReal(), fv.getVelocity().getX().getPartialDerivative(1), 1.0e-10);
Assert.assertEquals(fv.getAcceleration().getY().getReal(), fv.getVelocity().getY().getPartialDerivative(1), 1.0e-10);
Assert.assertEquals(fv.getAcceleration().getZ().getReal(), fv.getVelocity().getZ().getPartialDerivative(1), 1.0e-10);
Assert.assertEquals(fv.getAcceleration().getX().getPartialDerivative(1), fv.getVelocity().getX().getPartialDerivative(2), 1.0e-10);
Assert.assertEquals(fv.getAcceleration().getY().getPartialDerivative(1), fv.getVelocity().getY().getPartialDerivative(2), 1.0e-10);
Assert.assertEquals(fv.getAcceleration().getZ().getPartialDerivative(1), fv.getVelocity().getZ().getPartialDerivative(2), 1.0e-10);
for (double dt = 0; dt < 10; dt += 0.125) {
Vector3D p = new PVCoordinates(new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10), new Vector3D(10, -1.0, -100)).shiftedBy(dt).getPosition();
Assert.assertEquals(p.getX(), fv.getPosition().getX().taylor(dt), 1.0e-14);
Assert.assertEquals(p.getY(), fv.getPosition().getY().taylor(dt), 1.0e-14);
Assert.assertEquals(p.getZ(), fv.getPosition().getZ().taylor(dt), 1.0e-14);
}
}
use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.
the class PVCoordinatesTest method testLinearConstructors.
@Test
public void testLinearConstructors() {
PVCoordinates pv1 = new PVCoordinates(new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10));
PVCoordinates pv2 = new PVCoordinates(new Vector3D(2, 0.2, 20), new Vector3D(-2, -0.2, -20));
PVCoordinates pv3 = new PVCoordinates(new Vector3D(3, 0.3, 30), new Vector3D(-3, -0.3, -30));
PVCoordinates pv4 = new PVCoordinates(new Vector3D(4, 0.4, 40), new Vector3D(-4, -0.4, -40));
checkPV(pv4, new PVCoordinates(4, pv1), 1.0e-15);
checkPV(pv2, new PVCoordinates(pv1, pv3), 1.0e-15);
checkPV(pv3, new PVCoordinates(1, pv1, 1, pv2), 1.0e-15);
checkPV(new PVCoordinates(2, pv4), new PVCoordinates(3, pv1, 1, pv2, 1, pv3), 1.0e-15);
checkPV(new PVCoordinates(3, pv3), new PVCoordinates(3, pv1, 1, pv2, 1, pv4), 1.0e-15);
checkPV(new PVCoordinates(5, pv4), new PVCoordinates(4, pv1, 3, pv2, 2, pv3, 1, pv4), 1.0e-15);
}
use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.
the class PVCoordinatesTest method testToDerivativeStructureVector2.
@Test
public void testToDerivativeStructureVector2() throws OrekitException {
FieldVector3D<DerivativeStructure> fv = new PVCoordinates(new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10), new Vector3D(10, -1.0, -100)).toDerivativeStructureVector(2);
Assert.assertEquals(1, fv.getX().getFreeParameters());
Assert.assertEquals(2, fv.getX().getOrder());
Assert.assertEquals(1.0, fv.getX().getReal(), 1.0e-10);
Assert.assertEquals(0.1, fv.getY().getReal(), 1.0e-10);
Assert.assertEquals(10.0, fv.getZ().getReal(), 1.0e-10);
Assert.assertEquals(-1.0, fv.getX().getPartialDerivative(1), 1.0e-15);
Assert.assertEquals(-0.1, fv.getY().getPartialDerivative(1), 1.0e-15);
Assert.assertEquals(-10.0, fv.getZ().getPartialDerivative(1), 1.0e-15);
Assert.assertEquals(10.0, fv.getX().getPartialDerivative(2), 1.0e-15);
Assert.assertEquals(-1.0, fv.getY().getPartialDerivative(2), 1.0e-15);
Assert.assertEquals(-100.0, fv.getZ().getPartialDerivative(2), 1.0e-15);
checkPV(new PVCoordinates(new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10), new Vector3D(10, -1.0, -100)), new PVCoordinates(fv), 1.0e-15);
for (double dt = 0; dt < 10; dt += 0.125) {
Vector3D p = new PVCoordinates(new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10), new Vector3D(10, -1.0, -100)).shiftedBy(dt).getPosition();
Assert.assertEquals(p.getX(), fv.getX().taylor(dt), 1.0e-14);
Assert.assertEquals(p.getY(), fv.getY().taylor(dt), 1.0e-14);
Assert.assertEquals(p.getZ(), fv.getZ().taylor(dt), 1.0e-14);
}
}
use of org.hipparchus.geometry.euclidean.threed.Vector3D in project Orekit by CS-SI.
the class SecularAndHarmonicTest method meanSolarTime.
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);
}
Aggregations