Example usage for org.apache.commons.math3.geometry.euclidean.threed FieldRotation applyTo

List of usage examples for org.apache.commons.math3.geometry.euclidean.threed FieldRotation applyTo

Introduction

In this page you can find the example usage for org.apache.commons.math3.geometry.euclidean.threed FieldRotation applyTo.

Prototype

public static <T extends RealFieldElement<T>> FieldRotation<T> applyTo(final Rotation r1,
        final FieldRotation<T> rInner) 

Source Link

Document

Apply a rotation to another rotation.

Usage

From source file:org.orekit.frames.Transform.java

/** Transform a position vector (including translation effects).
 * @param position vector to transform/*from  ww w.  ja  va 2s. c o  m*/
 * @param <T> the type of the field elements
 * @return transformed position
 */
public <T extends RealFieldElement<T>> FieldVector3D<T> transformPosition(final FieldVector3D<T> position) {
    return FieldRotation.applyTo(angular.getRotation(), position.add(cartesian.getPosition()));
}

From source file:org.orekit.frames.Transform.java

/** Transform a vector (ignoring translation effects).
 * @param vector vector to transform/*w w w.jav a  2 s  .c o m*/
 * @param <T> the type of the field elements
 * @return transformed vector
 */
public <T extends RealFieldElement<T>> FieldVector3D<T> transformVector(final FieldVector3D<T> vector) {
    return FieldRotation.applyTo(angular.getRotation(), vector);
}

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 ww w  . ja  v  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   ww w  . j av  a 2s .  c  om
 * 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);

}