List of usage examples for org.apache.commons.math3.geometry.euclidean.threed FieldVector3D crossProduct
public static <T extends RealFieldElement<T>> FieldVector3D<T> crossProduct(final Vector3D v1, final FieldVector3D<T> v2)
From source file:org.orekit.frames.Transform.java
/** Transform {@link FieldPVCoordinates} including kinematic effects. * @param pv position-velocity to transform. * @param <T> type of the field elements * @return transformed position-velocity *//*from w ww .j av a2 s . c o m*/ public <T extends RealFieldElement<T>> FieldPVCoordinates<T> transformPVCoordinates( final FieldPVCoordinates<T> pv) { // apply translation final FieldVector3D<T> intermediateP = pv.getPosition().add(cartesian.getPosition()); final FieldVector3D<T> intermediateV = pv.getVelocity().add(cartesian.getVelocity()); final FieldVector3D<T> intermediateA = pv.getAcceleration().add(cartesian.getAcceleration()); // apply rotation final FieldVector3D<T> transformedP = FieldRotation.applyTo(angular.getRotation(), intermediateP); final FieldVector3D<T> crossP = FieldVector3D.crossProduct(angular.getRotationRate(), transformedP); final FieldVector3D<T> transformedV = FieldRotation.applyTo(angular.getRotation(), intermediateV) .subtract(crossP); final FieldVector3D<T> crossV = FieldVector3D.crossProduct(angular.getRotationRate(), transformedV); final FieldVector3D<T> crossCrossP = FieldVector3D.crossProduct(angular.getRotationRate(), crossP); final FieldVector3D<T> crossDotP = FieldVector3D.crossProduct(angular.getRotationAcceleration(), transformedP); final FieldVector3D<T> transformedA = new FieldVector3D<T>(1, FieldRotation.applyTo(angular.getRotation(), intermediateA), -2, crossV, -1, crossCrossP, -1, crossDotP); // build transformed object return new FieldPVCoordinates<T>(transformedP, transformedV, transformedA); }
From source file:org.orekit.frames.Transform.java
/** Transform {@link TimeStampedFieldPVCoordinates} including kinematic effects. * <p>//from w ww. ja va 2s . c o m * In order to allow the user more flexibility, this method does <em>not</em> check for * consistency between the transform {@link #getDate() date} and the time-stamped * position-velocity {@link TimeStampedFieldPVCoordinates#getDate() date}. The returned * value will always have the same {@link TimeStampedFieldPVCoordinates#getDate() date} as * the input argument, regardless of the instance {@link #getDate() date}. * </p> * @param pv time-stamped position-velocity to transform. * @param <T> type of the field elements * @return transformed time-stamped position-velocity * @since 7.0 */ public <T extends RealFieldElement<T>> TimeStampedFieldPVCoordinates<T> transformPVCoordinates( final TimeStampedFieldPVCoordinates<T> pv) { // apply translation final FieldVector3D<T> intermediateP = pv.getPosition().add(cartesian.getPosition()); final FieldVector3D<T> intermediateV = pv.getVelocity().add(cartesian.getVelocity()); final FieldVector3D<T> intermediateA = pv.getAcceleration().add(cartesian.getAcceleration()); // apply rotation final FieldVector3D<T> transformedP = FieldRotation.applyTo(angular.getRotation(), intermediateP); final FieldVector3D<T> crossP = FieldVector3D.crossProduct(angular.getRotationRate(), transformedP); final FieldVector3D<T> transformedV = FieldRotation.applyTo(angular.getRotation(), intermediateV) .subtract(crossP); final FieldVector3D<T> crossV = FieldVector3D.crossProduct(angular.getRotationRate(), transformedV); final FieldVector3D<T> crossCrossP = FieldVector3D.crossProduct(angular.getRotationRate(), crossP); final FieldVector3D<T> crossDotP = FieldVector3D.crossProduct(angular.getRotationAcceleration(), transformedP); final FieldVector3D<T> transformedA = new FieldVector3D<T>(1, FieldRotation.applyTo(angular.getRotation(), intermediateA), -2, crossV, -1, crossCrossP, -1, crossDotP); // build transformed object return new TimeStampedFieldPVCoordinates<T>(pv.getDate(), transformedP, transformedV, transformedA); }
From source file:org.orekit.utils.FieldAngularCoordinates.java
/** Add an offset from the instance. * <p>//from w w w. ja va2 s .co m * We consider here that the offset FieldRotation<T> is applied first and the * instance is applied afterward. Note that angular coordinates do <em>not</em> * commute under this operation, i.e. {@code a.addOffset(b)} and {@code * b.addOffset(a)} lead to <em>different</em> results in most cases. * </p> * <p> * The two methods {@link #addOffset(FieldAngularCoordinates) addOffset} and * {@link #subtractOffset(FieldAngularCoordinates) subtractOffset} are designed * so that round trip applications are possible. This means that both {@code * ac1.subtractOffset(ac2).addOffset(ac2)} and {@code * ac1.addOffset(ac2).subtractOffset(ac2)} return angular coordinates equal to ac1. * </p> * @param offset offset to subtract * @return new instance, with offset subtracted * @see #subtractOffset(FieldAngularCoordinates) */ public FieldAngularCoordinates<T> addOffset(final FieldAngularCoordinates<T> offset) { final FieldVector3D<T> rOmega = rotation.applyTo(offset.rotationRate); final FieldVector3D<T> rOmegaDot = rotation.applyTo(offset.rotationAcceleration); return new FieldAngularCoordinates<T>(rotation.applyTo(offset.rotation), rotationRate.add(rOmega), new FieldVector3D<T>(1.0, rotationAcceleration, 1.0, rOmegaDot, -1.0, FieldVector3D.crossProduct(rotationRate, rOmega))); }
From source file:org.orekit.utils.FieldPVCoordinates.java
/** Gets the momentum. * <p>This vector is the p ⊗ v where p is position, v is velocity * and ⊗ is cross product. To get the real physical angular momentum * you need to multiply this vector by the mass.</p> * <p>The returned vector is recomputed each time this method is called, it * is not cached.</p>/*from w w w. ja v a2 s . co m*/ * @return a new instance of the momentum vector (m/s). */ public FieldVector3D<T> getMomentum() { return FieldVector3D.crossProduct(position, velocity); }
From source file:org.orekit.utils.TimeStampedFieldAngularCoordinates.java
/** Add an offset from the instance. * <p>//w w w . ja v a 2 s. c om * We consider here that the offset FieldRotation<T> is applied first and the * instance is applied afterward. Note that angular coordinates do <em>not</em> * commute under this operation, i.e. {@code a.addOffset(b)} and {@code * b.addOffset(a)} lead to <em>different</em> results in most cases. * </p> * <p> * The two methods {@link #addOffset(FieldAngularCoordinates) addOffset} and * {@link #subtractOffset(FieldAngularCoordinates) subtractOffset} are designed * so that round trip applications are possible. This means that both {@code * ac1.subtractOffset(ac2).addOffset(ac2)} and {@code * ac1.addOffset(ac2).subtractOffset(ac2)} return angular coordinates equal to ac1. * </p> * @param offset offset to subtract * @return new instance, with offset subtracted * @see #subtractOffset(FieldAngularCoordinates) */ public TimeStampedFieldAngularCoordinates<T> addOffset(final FieldAngularCoordinates<T> offset) { final FieldVector3D<T> rOmega = getRotation().applyTo(offset.getRotationRate()); final FieldVector3D<T> rOmegaDot = getRotation().applyTo(offset.getRotationAcceleration()); return new TimeStampedFieldAngularCoordinates<T>(date, getRotation().applyTo(offset.getRotation()), getRotationRate().add(rOmega), new FieldVector3D<T>(1.0, getRotationAcceleration(), 1.0, rOmegaDot, -1.0, FieldVector3D.crossProduct(getRotationRate(), rOmega))); }