List of usage examples for org.apache.commons.math3.geometry.euclidean.threed FieldVector3D getZ
public T getZ()
From source file:org.orekit.utils.PVCoordinatesDSTest.java
@Test public void testInterpolateNonPolynomial() { AbsoluteDate t0 = AbsoluteDate.J2000_EPOCH; List<Pair<AbsoluteDate, FieldPVCoordinates<DerivativeStructure>>> sample = new ArrayList<Pair<AbsoluteDate, FieldPVCoordinates<DerivativeStructure>>>(); for (double dt : new double[] { 0.0, 0.5, 1.0 }) { FieldVector3D<DerivativeStructure> position = createVector(FastMath.cos(dt), FastMath.sin(dt), 0.0, 6); FieldVector3D<DerivativeStructure> velocity = createVector(-FastMath.sin(dt), FastMath.cos(dt), 0.0, 6); sample.add(new Pair<AbsoluteDate, FieldPVCoordinates<DerivativeStructure>>(t0.shiftedBy(dt), new FieldPVCoordinates<DerivativeStructure>(position, velocity))); }// w ww .j a v a2 s . co m for (double dt = 0; dt < 1.0; dt += 0.01) { FieldPVCoordinates<DerivativeStructure> interpolated = FieldPVCoordinates.interpolate(t0.shiftedBy(dt), true, sample); FieldVector3D<DerivativeStructure> p = interpolated.getPosition(); FieldVector3D<DerivativeStructure> v = interpolated.getVelocity(); Assert.assertEquals(FastMath.cos(dt), p.getX().getValue(), 3.0e-6 * p.getNorm().getValue()); Assert.assertEquals(FastMath.sin(dt), p.getY().getValue(), 3.0e-6 * p.getNorm().getValue()); Assert.assertEquals(0, p.getZ().getValue(), 3.0e-6 * p.getNorm().getValue()); Assert.assertEquals(-FastMath.sin(dt), v.getX().getValue(), 3.0e-5 * v.getNorm().getValue()); Assert.assertEquals(FastMath.cos(dt), v.getY().getValue(), 3.0e-5 * v.getNorm().getValue()); Assert.assertEquals(0, v.getZ().getValue(), 3.0e-5 * v.getNorm().getValue()); } }
From source file:org.orekit.utils.PVCoordinatesTest.java
@Test public void testToDerivativeStructureVector0() 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(0); Assert.assertEquals(1, fv.getX().getFreeParameters()); Assert.assertEquals(0, 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); checkPV(new PVCoordinates(new Vector3D(1, 0.1, 10), Vector3D.ZERO, Vector3D.ZERO), new PVCoordinates(fv), 1.0e-15);//from w ww . ja v a2 s.c o m }
From source file:org.orekit.utils.PVCoordinatesTest.java
@Test public void testToDerivativeStructureVector1() 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(1); Assert.assertEquals(1, fv.getX().getFreeParameters()); Assert.assertEquals(1, 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); checkPV(new PVCoordinates(new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10), Vector3D.ZERO), new PVCoordinates(fv), 1.0e-15); }
From source file:org.orekit.utils.PVCoordinatesTest.java
@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); }//from ww w . ja v a 2 s. c o m }
From source file:org.orekit.utils.TimeStampedFieldPVCoordinatesTest.java
@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<TimeStampedFieldPVCoordinates<DerivativeStructure>> sample = new ArrayList<TimeStampedFieldPVCoordinates<DerivativeStructure>>(); for (double dt : new double[] { 0.0, 0.5, 1.0 }) { FieldVector3D<DerivativeStructure> position = createVector(px.value(dt), py.value(dt), pz.value(dt), 4);/*from www . j av a 2 s .c o m*/ FieldVector3D<DerivativeStructure> velocity = createVector(pxDot.value(dt), pyDot.value(dt), pzDot.value(dt), 4); FieldVector3D<DerivativeStructure> acceleration = createVector(pxDotDot.value(dt), pyDotDot.value(dt), pzDotDot.value(dt), 4); sample.add(new TimeStampedFieldPVCoordinates<DerivativeStructure>(t0.shiftedBy(dt), position, velocity, acceleration)); } for (double dt = 0; dt < 1.0; dt += 0.01) { TimeStampedFieldPVCoordinates<DerivativeStructure> interpolated = TimeStampedFieldPVCoordinates .interpolate(t0.shiftedBy(dt), CartesianDerivativesFilter.USE_PVA, sample); FieldVector3D<DerivativeStructure> p = interpolated.getPosition(); FieldVector3D<DerivativeStructure> v = interpolated.getVelocity(); FieldVector3D<DerivativeStructure> a = interpolated.getAcceleration(); Assert.assertEquals(px.value(dt), p.getX().getReal(), 4.0e-16 * p.getNorm().getReal()); Assert.assertEquals(py.value(dt), p.getY().getReal(), 4.0e-16 * p.getNorm().getReal()); Assert.assertEquals(pz.value(dt), p.getZ().getReal(), 4.0e-16 * p.getNorm().getReal()); Assert.assertEquals(pxDot.value(dt), v.getX().getReal(), 9.0e-16 * v.getNorm().getReal()); Assert.assertEquals(pyDot.value(dt), v.getY().getReal(), 9.0e-16 * v.getNorm().getReal()); Assert.assertEquals(pzDot.value(dt), v.getZ().getReal(), 9.0e-16 * v.getNorm().getReal()); Assert.assertEquals(pxDotDot.value(dt), a.getX().getReal(), 6.0e-15 * a.getNorm().getReal()); Assert.assertEquals(pyDotDot.value(dt), a.getY().getReal(), 6.0e-15 * a.getNorm().getReal()); Assert.assertEquals(pzDotDot.value(dt), a.getZ().getReal(), 6.0e-15 * a.getNorm().getReal()); } } }
From source file:org.orekit.utils.TimeStampedFieldPVCoordinatesTest.java
@Test public void testInterpolatePolynomialPV() { Random random = new Random(0xae7771c9933407bdl); 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<TimeStampedFieldPVCoordinates<DerivativeStructure>> sample = new ArrayList<TimeStampedFieldPVCoordinates<DerivativeStructure>>(); for (double dt : new double[] { 0.0, 0.5, 1.0 }) { FieldVector3D<DerivativeStructure> position = createVector(px.value(dt), py.value(dt), pz.value(dt), 4);/*from w w w . j a v a 2s . com*/ FieldVector3D<DerivativeStructure> velocity = createVector(pxDot.value(dt), pyDot.value(dt), pzDot.value(dt), 4); sample.add(new TimeStampedFieldPVCoordinates<DerivativeStructure>(t0.shiftedBy(dt), position, velocity, createVector(0, 0, 0, 4))); } for (double dt = 0; dt < 1.0; dt += 0.01) { TimeStampedFieldPVCoordinates<DerivativeStructure> interpolated = TimeStampedFieldPVCoordinates .interpolate(t0.shiftedBy(dt), CartesianDerivativesFilter.USE_PV, sample); FieldVector3D<DerivativeStructure> p = interpolated.getPosition(); FieldVector3D<DerivativeStructure> v = interpolated.getVelocity(); FieldVector3D<DerivativeStructure> a = interpolated.getAcceleration(); Assert.assertEquals(px.value(dt), p.getX().getReal(), 4.0e-16 * p.getNorm().getReal()); Assert.assertEquals(py.value(dt), p.getY().getReal(), 4.0e-16 * p.getNorm().getReal()); Assert.assertEquals(pz.value(dt), p.getZ().getReal(), 4.0e-16 * p.getNorm().getReal()); Assert.assertEquals(pxDot.value(dt), v.getX().getReal(), 9.0e-16 * v.getNorm().getReal()); Assert.assertEquals(pyDot.value(dt), v.getY().getReal(), 9.0e-16 * v.getNorm().getReal()); Assert.assertEquals(pzDot.value(dt), v.getZ().getReal(), 9.0e-16 * v.getNorm().getReal()); Assert.assertEquals(pxDotDot.value(dt), a.getX().getReal(), 1.0e-14 * a.getNorm().getReal()); Assert.assertEquals(pyDotDot.value(dt), a.getY().getReal(), 1.0e-14 * a.getNorm().getReal()); Assert.assertEquals(pzDotDot.value(dt), a.getZ().getReal(), 1.0e-14 * a.getNorm().getReal()); } } }
From source file:org.orekit.utils.TimeStampedFieldPVCoordinatesTest.java
@Test public void testInterpolatePolynomialPositionOnly() { Random random = new Random(0x88740a12e4299003l); 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<TimeStampedFieldPVCoordinates<DerivativeStructure>> sample = new ArrayList<TimeStampedFieldPVCoordinates<DerivativeStructure>>(); for (double dt : new double[] { 0.0, 0.2, 0.4, 0.6, 0.8, 1.0 }) { FieldVector3D<DerivativeStructure> position = createVector(px.value(dt), py.value(dt), pz.value(dt), 4);//from w ww .j a v a 2 s.com sample.add(new TimeStampedFieldPVCoordinates<DerivativeStructure>(t0.shiftedBy(dt), position, createVector(0, 0, 0, 4), createVector(0, 0, 0, 4))); } for (double dt = 0; dt < 1.0; dt += 0.01) { TimeStampedFieldPVCoordinates<DerivativeStructure> interpolated = TimeStampedFieldPVCoordinates .interpolate(t0.shiftedBy(dt), CartesianDerivativesFilter.USE_P, sample); FieldVector3D<DerivativeStructure> p = interpolated.getPosition(); FieldVector3D<DerivativeStructure> v = interpolated.getVelocity(); FieldVector3D<DerivativeStructure> a = interpolated.getAcceleration(); Assert.assertEquals(px.value(dt), p.getX().getReal(), 5.0e-16 * p.getNorm().getReal()); Assert.assertEquals(py.value(dt), p.getY().getReal(), 5.0e-16 * p.getNorm().getReal()); Assert.assertEquals(pz.value(dt), p.getZ().getReal(), 5.0e-16 * p.getNorm().getReal()); Assert.assertEquals(pxDot.value(dt), v.getX().getReal(), 7.0e-15 * v.getNorm().getReal()); Assert.assertEquals(pyDot.value(dt), v.getY().getReal(), 7.0e-15 * v.getNorm().getReal()); Assert.assertEquals(pzDot.value(dt), v.getZ().getReal(), 7.0e-15 * v.getNorm().getReal()); Assert.assertEquals(pxDotDot.value(dt), a.getX().getReal(), 2.0e-13 * a.getNorm().getReal()); Assert.assertEquals(pyDotDot.value(dt), a.getY().getReal(), 2.0e-13 * a.getNorm().getReal()); Assert.assertEquals(pzDotDot.value(dt), a.getZ().getReal(), 2.0e-13 * a.getNorm().getReal()); } } }
From source file:org.orekit.utils.TimeStampedFieldPVCoordinatesTest.java
@Test public void testInterpolateNonPolynomial() { AbsoluteDate t0 = AbsoluteDate.J2000_EPOCH; List<TimeStampedFieldPVCoordinates<DerivativeStructure>> sample = new ArrayList<TimeStampedFieldPVCoordinates<DerivativeStructure>>(); for (double dt : new double[] { 0.0, 0.5, 1.0 }) { FieldVector3D<DerivativeStructure> position = createVector(FastMath.cos(dt), FastMath.sin(dt), 0.0, 4); FieldVector3D<DerivativeStructure> velocity = createVector(-FastMath.sin(dt), FastMath.cos(dt), 0.0, 4); FieldVector3D<DerivativeStructure> acceleration = createVector(-FastMath.cos(dt), -FastMath.sin(dt), 0.0, 4);/*from w w w. ja va2s .c om*/ sample.add(new TimeStampedFieldPVCoordinates<DerivativeStructure>(t0.shiftedBy(dt), position, velocity, acceleration)); } for (double dt = 0; dt < 1.0; dt += 0.01) { TimeStampedFieldPVCoordinates<DerivativeStructure> interpolated = TimeStampedFieldPVCoordinates .interpolate(t0.shiftedBy(dt), CartesianDerivativesFilter.USE_PVA, sample); FieldVector3D<DerivativeStructure> p = interpolated.getPosition(); FieldVector3D<DerivativeStructure> v = interpolated.getVelocity(); FieldVector3D<DerivativeStructure> a = interpolated.getAcceleration(); Assert.assertEquals(FastMath.cos(dt), p.getX().getReal(), 3.0e-10 * p.getNorm().getReal()); Assert.assertEquals(FastMath.sin(dt), p.getY().getReal(), 3.0e-10 * p.getNorm().getReal()); Assert.assertEquals(0, p.getZ().getReal(), 3.0e-10 * p.getNorm().getReal()); Assert.assertEquals(-FastMath.sin(dt), v.getX().getReal(), 3.0e-9 * v.getNorm().getReal()); Assert.assertEquals(FastMath.cos(dt), v.getY().getReal(), 3.0e-9 * v.getNorm().getReal()); Assert.assertEquals(0, v.getZ().getReal(), 3.0e-9 * v.getNorm().getReal()); Assert.assertEquals(-FastMath.cos(dt), a.getX().getReal(), 4.0e-8 * a.getNorm().getReal()); Assert.assertEquals(-FastMath.sin(dt), a.getY().getReal(), 4.0e-8 * a.getNorm().getReal()); Assert.assertEquals(0, a.getZ().getReal(), 4.0e-8 * a.getNorm().getReal()); } }
From source file:org.orekit.utils.TimeStampedPVCoordinatesTest.java
@Test public void testToDerivativeStructureVector2() throws OrekitException { FieldVector3D<DerivativeStructure> fv = new TimeStampedPVCoordinates(AbsoluteDate.GALILEO_EPOCH, 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 TimeStampedPVCoordinates(AbsoluteDate.GALILEO_EPOCH, new Vector3D(1, 0.1, 10), new Vector3D(-1, -0.1, -10), new Vector3D(10, -1.0, -100)), new TimeStampedPVCoordinates(AbsoluteDate.GALILEO_EPOCH, 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); }//from w w w . j av a 2s . co m }