List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Vector3D ZERO
Vector3D ZERO
To view the source code for org.apache.commons.math3.geometry.euclidean.threed Vector3D ZERO.
Click Source Link
From source file:org.orekit.frames.TopocentricFrame.java
/** Simple constructor. * @param parentShape body shape on which the local point is defined * @param point local surface point where topocentric frame is defined * @param name the string representation *///from w w w .j a v a2 s . c o m public TopocentricFrame(final BodyShape parentShape, final GeodeticPoint point, final String name) { super(parentShape.getBodyFrame(), new Transform(AbsoluteDate.J2000_EPOCH, new Transform(AbsoluteDate.J2000_EPOCH, parentShape.transform(point).negate()), new Transform(AbsoluteDate.J2000_EPOCH, new Rotation(point.getEast(), point.getZenith(), Vector3D.PLUS_I, Vector3D.PLUS_K), Vector3D.ZERO)), name, false); this.parentShape = parentShape; this.point = point; }
From source file:org.orekit.frames.TopocentricFrame.java
/** Get the {@link PVCoordinates} of the topocentric frame origin in the selected frame. * @param date current date// w w w . j a v a 2 s.com * @param frame the frame where to define the position * @return position/velocity of the topocentric frame origin (m and m/s) * @exception OrekitException if position cannot be computed in given frame */ public TimeStampedPVCoordinates getPVCoordinates(final AbsoluteDate date, final Frame frame) throws OrekitException { return getTransformTo(frame, date).transformPVCoordinates( new TimeStampedPVCoordinates(date, Vector3D.ZERO, Vector3D.ZERO, Vector3D.ZERO)); }
From source file:org.orekit.frames.Transform.java
/** Build a translation transform. * @param date date of the transform// w w w . j a va 2 s .com * @param translation translation to apply (i.e. coordinates of * the transformed origin, or coordinates of the origin of the * old frame in the new frame) */ public Transform(final AbsoluteDate date, final Vector3D translation) { this(date, new PVCoordinates(translation, Vector3D.ZERO, Vector3D.ZERO), AngularCoordinates.IDENTITY); }
From source file:org.orekit.frames.Transform.java
/** Build a rotation transform. * @param date date of the transform//from w w w .ja va2s . co m * @param rotation rotation to apply ( i.e. rotation to apply to the * coordinates of a vector expressed in the old frame to obtain the * same vector expressed in the new frame ) */ public Transform(final AbsoluteDate date, final Rotation rotation) { this(date, PVCoordinates.ZERO, new AngularCoordinates(rotation, Vector3D.ZERO)); }
From source file:org.orekit.frames.Transform.java
/** Build a translation transform, with its first time derivative. * @param date date of the transform//from w w w . j av a2s. co m * @param translation translation to apply (i.e. coordinates of * the transformed origin, or coordinates of the origin of the * old frame in the new frame) * @param velocity the velocity of the translation (i.e. origin * of the old frame velocity in the new frame) */ public Transform(final AbsoluteDate date, final Vector3D translation, final Vector3D velocity) { this(date, new PVCoordinates(translation, velocity, Vector3D.ZERO), AngularCoordinates.IDENTITY); }
From source file:org.orekit.frames.Transform.java
/** Build a rotation transform. * @param date date of the transform// w w w . j a va2s .c o m * @param rotation rotation to apply ( i.e. rotation to apply to the * coordinates of a vector expressed in the old frame to obtain the * same vector expressed in the new frame ) * @param rotationRate the axis of the instant rotation * expressed in the new frame. (norm representing angular rate) */ public Transform(final AbsoluteDate date, final Rotation rotation, final Vector3D rotationRate) { this(date, PVCoordinates.ZERO, new AngularCoordinates(rotation, rotationRate, Vector3D.ZERO)); }
From source file:org.orekit.frames.Transform.java
/** Get a frozen transform. * <p>/*from w ww. ja v a 2 s. c o m*/ * This method creates a copy of the instance but frozen in time, * i.e. with velocity, acceleration and rotation rate forced to zero. * </p> * @return a new transform, without any time-dependent parts */ public Transform freeze() { return new Transform(date, new PVCoordinates(cartesian.getPosition(), Vector3D.ZERO, Vector3D.ZERO), new AngularCoordinates(angular.getRotation(), Vector3D.ZERO, Vector3D.ZERO)); }
From source file:org.orekit.frames.TransformTest.java
@Test public void testAcceleration() { PVCoordinates initPV = new PVCoordinates(new Vector3D(9, 8, 7), new Vector3D(6, 5, 4), new Vector3D(3, 2, 1)); for (double dt = 0; dt < 1; dt += 0.01) { PVCoordinates basePV = initPV.shiftedBy(dt); PVCoordinates transformedPV = evolvingTransform(AbsoluteDate.J2000_EPOCH, dt) .transformPVCoordinates(basePV); // rebuild transformed acceleration, relying only on transformed position and velocity List<TimeStampedPVCoordinates> sample = new ArrayList<TimeStampedPVCoordinates>(); double h = 1.0e-2; for (int i = -3; i < 4; ++i) { Transform t = evolvingTransform(AbsoluteDate.J2000_EPOCH, dt + i * h); PVCoordinates pv = t.transformPVCoordinates(initPV.shiftedBy(dt + i * h)); sample.add(new TimeStampedPVCoordinates(t.getDate(), pv.getPosition(), pv.getVelocity(), Vector3D.ZERO)); }//w w w. jav a 2s. co m PVCoordinates rebuiltPV = TimeStampedPVCoordinates.interpolate(AbsoluteDate.J2000_EPOCH.shiftedBy(dt), CartesianDerivativesFilter.USE_PV, sample); checkVector(rebuiltPV.getPosition(), transformedPV.getPosition(), 4.0e-16); checkVector(rebuiltPV.getVelocity(), transformedPV.getVelocity(), 2.0e-16); checkVector(rebuiltPV.getAcceleration(), transformedPV.getAcceleration(), 9.0e-11); } }
From source file:org.orekit.frames.TransformTest.java
@Test public void testJacobianP() { // base directions for finite differences PVCoordinates[] directions = new PVCoordinates[] { new PVCoordinates(Vector3D.PLUS_I, Vector3D.ZERO, Vector3D.ZERO), new PVCoordinates(Vector3D.PLUS_J, Vector3D.ZERO, Vector3D.ZERO), new PVCoordinates(Vector3D.PLUS_K, Vector3D.ZERO, Vector3D.ZERO), }; double h = 0.01; RandomGenerator random = new Well19937a(0x47fd0d6809f4b173l); for (int i = 0; i < 20; ++i) { // generate a random transform Transform combined = randomTransform(random); // compute Jacobian double[][] jacobian = new double[9][9]; for (int l = 0; l < jacobian.length; ++l) { for (int c = 0; c < jacobian[l].length; ++c) { jacobian[l][c] = l + 0.1 * c; }//from w ww . ja v a 2s . co m } combined.getJacobian(CartesianDerivativesFilter.USE_P, jacobian); for (int j = 0; j < 100; ++j) { PVCoordinates pv0 = new PVCoordinates(randomVector(1e3, random), randomVector(1.0, random), randomVector(1.0e-3, random)); double epsilonP = 2.0e-12 * pv0.getPosition().getNorm(); for (int c = 0; c < directions.length; ++c) { // eight points finite differences estimation of a Jacobian column PVCoordinates pvm4h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, -4 * h, directions[c])); PVCoordinates pvm3h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, -3 * h, directions[c])); PVCoordinates pvm2h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, -2 * h, directions[c])); PVCoordinates pvm1h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, -1 * h, directions[c])); PVCoordinates pvp1h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, +1 * h, directions[c])); PVCoordinates pvp2h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, +2 * h, directions[c])); PVCoordinates pvp3h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, +3 * h, directions[c])); PVCoordinates pvp4h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, +4 * h, directions[c])); PVCoordinates d4 = new PVCoordinates(pvm4h, pvp4h); PVCoordinates d3 = new PVCoordinates(pvm3h, pvp3h); PVCoordinates d2 = new PVCoordinates(pvm2h, pvp2h); PVCoordinates d1 = new PVCoordinates(pvm1h, pvp1h); double d = 1.0 / (840 * h); PVCoordinates estimatedColumn = new PVCoordinates(-3 * d, d4, 32 * d, d3, -168 * d, d2, 672 * d, d1); // check analytical Jacobian against finite difference reference Assert.assertEquals(estimatedColumn.getPosition().getX(), jacobian[0][c], epsilonP); Assert.assertEquals(estimatedColumn.getPosition().getY(), jacobian[1][c], epsilonP); Assert.assertEquals(estimatedColumn.getPosition().getZ(), jacobian[2][c], epsilonP); // check the rest of the matrix remains untouched for (int l = 3; l < jacobian.length; ++l) { Assert.assertEquals(l + 0.1 * c, jacobian[l][c], 1.0e-15); } } // check the rest of the matrix remains untouched for (int c = directions.length; c < jacobian[0].length; ++c) { for (int l = 0; l < jacobian.length; ++l) { Assert.assertEquals(l + 0.1 * c, jacobian[l][c], 1.0e-15); } } } } }
From source file:org.orekit.frames.TransformTest.java
@Test public void testJacobianPV() { // base directions for finite differences PVCoordinates[] directions = new PVCoordinates[] { new PVCoordinates(Vector3D.PLUS_I, Vector3D.ZERO, Vector3D.ZERO), new PVCoordinates(Vector3D.PLUS_J, Vector3D.ZERO, Vector3D.ZERO), new PVCoordinates(Vector3D.PLUS_K, Vector3D.ZERO, Vector3D.ZERO), new PVCoordinates(Vector3D.ZERO, Vector3D.PLUS_I, Vector3D.ZERO), new PVCoordinates(Vector3D.ZERO, Vector3D.PLUS_J, Vector3D.ZERO), new PVCoordinates(Vector3D.ZERO, Vector3D.PLUS_K, Vector3D.ZERO) }; double h = 0.01; RandomGenerator random = new Well19937a(0xce2bfddfbb9796bel); for (int i = 0; i < 20; ++i) { // generate a random transform Transform combined = randomTransform(random); // compute Jacobian double[][] jacobian = new double[9][9]; for (int l = 0; l < jacobian.length; ++l) { for (int c = 0; c < jacobian[l].length; ++c) { jacobian[l][c] = l + 0.1 * c; }/*from w w w.ja v a 2 s . c o m*/ } combined.getJacobian(CartesianDerivativesFilter.USE_PV, jacobian); for (int j = 0; j < 100; ++j) { PVCoordinates pv0 = new PVCoordinates(randomVector(1e3, random), randomVector(1.0, random), randomVector(1.0e-3, random)); double epsilonP = 2.0e-12 * pv0.getPosition().getNorm(); double epsilonV = 6.0e-11 * pv0.getVelocity().getNorm(); for (int c = 0; c < directions.length; ++c) { // eight points finite differences estimation of a Jacobian column PVCoordinates pvm4h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, -4 * h, directions[c])); PVCoordinates pvm3h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, -3 * h, directions[c])); PVCoordinates pvm2h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, -2 * h, directions[c])); PVCoordinates pvm1h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, -1 * h, directions[c])); PVCoordinates pvp1h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, +1 * h, directions[c])); PVCoordinates pvp2h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, +2 * h, directions[c])); PVCoordinates pvp3h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, +3 * h, directions[c])); PVCoordinates pvp4h = combined .transformPVCoordinates(new PVCoordinates(1.0, pv0, +4 * h, directions[c])); PVCoordinates d4 = new PVCoordinates(pvm4h, pvp4h); PVCoordinates d3 = new PVCoordinates(pvm3h, pvp3h); PVCoordinates d2 = new PVCoordinates(pvm2h, pvp2h); PVCoordinates d1 = new PVCoordinates(pvm1h, pvp1h); double d = 1.0 / (840 * h); PVCoordinates estimatedColumn = new PVCoordinates(-3 * d, d4, 32 * d, d3, -168 * d, d2, 672 * d, d1); // check analytical Jacobian against finite difference reference Assert.assertEquals(estimatedColumn.getPosition().getX(), jacobian[0][c], epsilonP); Assert.assertEquals(estimatedColumn.getPosition().getY(), jacobian[1][c], epsilonP); Assert.assertEquals(estimatedColumn.getPosition().getZ(), jacobian[2][c], epsilonP); Assert.assertEquals(estimatedColumn.getVelocity().getX(), jacobian[3][c], epsilonV); Assert.assertEquals(estimatedColumn.getVelocity().getY(), jacobian[4][c], epsilonV); Assert.assertEquals(estimatedColumn.getVelocity().getZ(), jacobian[5][c], epsilonV); // check the rest of the matrix remains untouched for (int l = 6; l < jacobian.length; ++l) { Assert.assertEquals(l + 0.1 * c, jacobian[l][c], 1.0e-15); } } // check the rest of the matrix remains untouched for (int c = directions.length; c < jacobian[0].length; ++c) { for (int l = 0; l < jacobian.length; ++l) { Assert.assertEquals(l + 0.1 * c, jacobian[l][c], 1.0e-15); } } } } }