Tudat/Astrodynamics/BasicAstrodynamics/attitudeElementConversions.cpp
//! Convert quaternions to modified Rodrigues parameters.
Convert quaternions to modified Rodrigues parameters.
Convert quaternions to modified Rodrigues parameters .
Eigen::Vector4d convertQuaternionsToModifiedRodriguesParameterElements( const Eigen::Vector4d& quaternionElements )
{
    Eigen::Vector4d convertedModifiedRodriguesParameterElements;
    double etaQuaternionParameter = quaternionElements( etaQuaternionIndex );
    bool shadowFlag = etaQuaternionParameter < 0;
    double conversionSign = shadowFlag ? - 1.0 : 1.0; 
    convertedModifiedRodriguesParameterElements.segment( sigma1ModifiedRodriguesParametersIndex, 3 ) = conversionSign *
            quaternionElements.segment( epsilon1QuaternionIndex, 3 ) / ( 1 + conversionSign * etaQuaternionParameter );
    convertedModifiedRodriguesParameterElements( shadowFlagModifiedRodriguesParametersIndex ) = shadowFlag ? 1.0 : 0.0;
    return convertedModifiedRodriguesParameterElements;
}
Eigen :: Vector4d convertQuaternionsToModifiedRodriguesParameterElements ( const Eigen :: Vector4d & quaternionElements ) { Eigen :: Vector4d convertedModifiedRodriguesParameterElements ; double etaQuaternionParameter = quaternionElements ( etaQuaternionIndex ) ; bool shadowFlag = etaQuaternionParameter < 0 ; double conversionSign = shadowFlag ? - 1.0 : 1.0 ; convertedModifiedRodriguesParameterElements . segment ( sigma1ModifiedRodriguesParametersIndex , 3 ) = conversionSign * quaternionElements . segment ( epsilon1QuaternionIndex , 3 ) / ( 1 + conversionSign * etaQuaternionParameter ) ; convertedModifiedRodriguesParameterElements ( shadowFlagModifiedRodriguesParametersIndex ) = shadowFlag ? 1.0 : 0.0 ; return convertedModifiedRodriguesParameterElements ; }
Convert quaternions to modified Rodrigues parameters.
Convert quaternions to modified Rodrigues parameters .
// Declare eventual output vector // Extract quaternions // Convert quaternions to modified Rodrigues parameters (or SMPR) // conversion is slightly different for SMRP and MRP // Give output