List of usage examples for org.apache.commons.math3.geometry.euclidean.threed Vector3D Vector3D
public Vector3D(double a1, Vector3D u1, double a2, Vector3D u2, double a3, Vector3D u3, double a4, Vector3D u4)
From source file:org.orekit.bodies.JPLEphemeridesLoaderTest.java
private void checkDerivative(String supportedNames, AbsoluteDate date) throws OrekitException, ParseException { JPLEphemeridesLoader loader = new JPLEphemeridesLoader(supportedNames, JPLEphemeridesLoader.EphemerisType.MERCURY); CelestialBody body = loader.loadCelestialBody(CelestialBodyFactory.MERCURY); double h = 20; // eight points finite differences estimation of the velocity Frame eme2000 = FramesFactory.getEME2000(); Vector3D pm4h = body.getPVCoordinates(date.shiftedBy(-4 * h), eme2000).getPosition(); Vector3D pm3h = body.getPVCoordinates(date.shiftedBy(-3 * h), eme2000).getPosition(); Vector3D pm2h = body.getPVCoordinates(date.shiftedBy(-2 * h), eme2000).getPosition(); Vector3D pm1h = body.getPVCoordinates(date.shiftedBy(-h), eme2000).getPosition(); Vector3D pp1h = body.getPVCoordinates(date.shiftedBy(h), eme2000).getPosition(); Vector3D pp2h = body.getPVCoordinates(date.shiftedBy(2 * h), eme2000).getPosition(); Vector3D pp3h = body.getPVCoordinates(date.shiftedBy(3 * h), eme2000).getPosition(); Vector3D pp4h = body.getPVCoordinates(date.shiftedBy(4 * h), eme2000).getPosition(); Vector3D d4 = pp4h.subtract(pm4h); Vector3D d3 = pp3h.subtract(pm3h); Vector3D d2 = pp2h.subtract(pm2h); Vector3D d1 = pp1h.subtract(pm1h); double c = 1.0 / (840 * h); Vector3D estimatedV = new Vector3D(-3 * c, d4, 32 * c, d3, -168 * c, d2, 672 * c, d1); Vector3D loadedV = body.getPVCoordinates(date, eme2000).getVelocity(); Assert.assertEquals(0, loadedV.subtract(estimatedV).getNorm(), 5.0e-11 * loadedV.getNorm()); }
From source file:org.orekit.frames.Transform.java
/** Compute a composite acceleration. * @param first first applied transform//from ww w . jav a 2 s .c om * @param second second applied transform * @return acceleration part of the composite transform */ private static Vector3D compositeAcceleration(final Transform first, final Transform second) { final Vector3D a1 = first.cartesian.getAcceleration(); final Rotation r1 = first.angular.getRotation(); final Vector3D o1 = first.angular.getRotationRate(); final Vector3D oDot1 = first.angular.getRotationAcceleration(); final Vector3D p2 = second.cartesian.getPosition(); final Vector3D v2 = second.cartesian.getVelocity(); final Vector3D a2 = second.cartesian.getAcceleration(); final Vector3D crossCrossP = Vector3D.crossProduct(o1, Vector3D.crossProduct(o1, p2)); final Vector3D crossV = Vector3D.crossProduct(o1, v2); final Vector3D crossDotP = Vector3D.crossProduct(oDot1, p2); return a1.add(r1.applyInverseTo(new Vector3D(1, a2, 2, crossV, 1, crossCrossP, 1, crossDotP))); }
From source file:org.orekit.frames.Transform.java
/** Get the inverse transform of the instance. * @return inverse transform of the instance *///from ww w. ja va 2s . c o m public Transform getInverse() { final Rotation r = angular.getRotation(); final Vector3D o = angular.getRotationRate(); final Vector3D oDot = angular.getRotationAcceleration(); final Vector3D rp = r.applyTo(cartesian.getPosition()); final Vector3D rv = r.applyTo(cartesian.getVelocity()); final Vector3D ra = r.applyTo(cartesian.getAcceleration()); final Vector3D pInv = rp.negate(); final Vector3D crossP = Vector3D.crossProduct(o, rp); final Vector3D vInv = crossP.subtract(rv); final Vector3D crossV = Vector3D.crossProduct(o, rv); final Vector3D crossDotP = Vector3D.crossProduct(oDot, rp); final Vector3D crossCrossP = Vector3D.crossProduct(o, crossP); final Vector3D aInv = new Vector3D(-1, ra, 2, crossV, 1, crossDotP, -1, crossCrossP); return new Transform(date, new PVCoordinates(pInv, vInv, aInv), angular.revert()); }