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

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

Introduction

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

Prototype

public static <T extends RealFieldElement<T>> FieldRotation<T> applyInverseTo(final Rotation rOuter,
        final FieldRotation<T> rInner) 

Source Link

Document

Apply the inverse of a rotation to another rotation.

Usage

From source file:org.orekit.forces.BoxAndSolarArraySpacecraft.java

/** {@inheritDoc} */
public FieldVector3D<DerivativeStructure> radiationPressureAcceleration(final AbsoluteDate date,
        final Frame frame, final Vector3D position, final Rotation rotation, final double mass,
        final Vector3D flux, final String paramName) throws OrekitException {

    if (flux.getNormSq() < Precision.SAFE_MIN) {
        // null illumination (we are probably in umbra)
        final DerivativeStructure zero = new DerivativeStructure(1, 1, 0.0);
        return new FieldVector3D<DerivativeStructure>(zero, zero, zero);
    }//w  w w .  j  a  v a  2 s . com

    final DerivativeStructure absorptionCoeffDS;
    final DerivativeStructure specularReflectionCoeffDS;
    if (ABSORPTION_COEFFICIENT.equals(paramName)) {
        absorptionCoeffDS = new DerivativeStructure(1, 1, 0, absorptionCoeff);
        specularReflectionCoeffDS = new DerivativeStructure(1, 1, specularReflectionCoeff);
    } else if (REFLECTION_COEFFICIENT.equals(paramName)) {
        absorptionCoeffDS = new DerivativeStructure(1, 1, absorptionCoeff);
        specularReflectionCoeffDS = new DerivativeStructure(1, 1, 0, specularReflectionCoeff);
    } else {
        throw new OrekitException(OrekitMessages.UNSUPPORTED_PARAMETER_NAME, paramName,
                ABSORPTION_COEFFICIENT + ", " + REFLECTION_COEFFICIENT);
    }
    final DerivativeStructure diffuseReflectionCoeffDS = absorptionCoeffDS.add(specularReflectionCoeffDS)
            .subtract(1).negate();

    // radiation flux in spacecraft frame
    final Vector3D fluxSat = rotation.applyTo(flux);

    // solar array contribution
    Vector3D normal = getNormal(date, frame, position, rotation);
    double dot = Vector3D.dotProduct(normal, fluxSat);
    if (dot > 0) {
        // the solar array is illuminated backward,
        // fix signs to compute contribution correctly
        dot = -dot;
        normal = normal.negate();
    }
    FieldVector3D<DerivativeStructure> force = facetRadiationAcceleration(normal, solarArrayArea, fluxSat, dot,
            specularReflectionCoeffDS, diffuseReflectionCoeffDS);

    // body facets contribution
    for (final Facet bodyFacet : facets) {
        normal = bodyFacet.getNormal();
        dot = Vector3D.dotProduct(normal, fluxSat);
        if (dot < 0) {
            // the facet intercepts the incoming flux
            force = force.add(facetRadiationAcceleration(normal, bodyFacet.getArea(), fluxSat, dot,
                    specularReflectionCoeffDS, diffuseReflectionCoeffDS));
        }
    }

    // convert to inertial
    return FieldRotation.applyInverseTo(rotation, new FieldVector3D<DerivativeStructure>(1.0 / mass, force));

}