Tudat/Astrodynamics/Relativity/relativisticLightTimeCorrection.cpp
//! Function to calculate gradient of first order relativistic light time correction due to a gravitating point mass.

Function to calculate gradient of first order relativistic light time correction due to a gravitating point mass.
Function to calculate gradient of first order relativistic light time correction due to a gravitating point mass .
Eigen::Matrix< double, 1, 3 > calculateFirstOrderCentralBodyLightTimeCorrectionGradient(
        const double bodyGravitationalParameter,
        const Eigen::Vector3d& transmitterPosition,
        const Eigen::Vector3d& receiverPosition,
        const Eigen::Vector3d& centralBodyPosition,
        const bool evaluateGradientAtReceiver,
        const double ppnParameterGamma )
{
    Eigen::Vector3d relativePositionVector = ( receiverPosition - transmitterPosition );
    double receiverDistance = ( receiverPosition - centralBodyPosition ).norm( );
    double transmitterDistance = ( transmitterPosition - centralBodyPosition ).norm( );
    double linkEndDistance = relativePositionVector.norm( );
    Eigen::Matrix< double, 1, 3 > gradient = ( receiverDistance + transmitterDistance ) *
            ( relativePositionVector.normalized( ) ).transpose( );
    if( evaluateGradientAtReceiver )
    {
       gradient -= relativePositionVector.norm( ) * ( receiverPosition.normalized( ) ).transpose( );
    }
    else
    {
        gradient += relativePositionVector.norm( ) * ( transmitterPosition.normalized( ) ).transpose( );\
    }
    return 2.0 * ppnParameterGamma * bodyGravitationalParameter * physical_constants::INVERSE_CUBIC_SPEED_OF_LIGHT * gradient /
            ( ( receiverDistance + transmitterDistance ) * ( receiverDistance + transmitterDistance ) -
                  linkEndDistance * linkEndDistance );
}
Eigen :: Matrix < double , 1 , 3 > calculateFirstOrderCentralBodyLightTimeCorrectionGradient ( const double bodyGravitationalParameter , const Eigen :: Vector3d & transmitterPosition , const Eigen :: Vector3d & receiverPosition , const Eigen :: Vector3d & centralBodyPosition , const bool evaluateGradientAtReceiver , const double ppnParameterGamma ) { Eigen :: Vector3d relativePositionVector = ( receiverPosition - transmitterPosition ) ; double receiverDistance = ( receiverPosition - centralBodyPosition ) . norm ( ) ; double transmitterDistance = ( transmitterPosition - centralBodyPosition ) . norm ( ) ; double linkEndDistance = relativePositionVector . norm ( ) ; Eigen :: Matrix < double , 1 , 3 > gradient = ( receiverDistance + transmitterDistance ) * ( relativePositionVector . normalized ( ) ) . transpose ( ) ; if ( evaluateGradientAtReceiver ) { gradient -= relativePositionVector . norm ( ) * ( receiverPosition . normalized ( ) ) . transpose ( ) ; } else { gradient += relativePositionVector . norm ( ) * ( transmitterPosition . normalized ( ) ) . transpose ( ) ; } return 2.0 * ppnParameterGamma * bodyGravitationalParameter * physical_constants :: INVERSE_CUBIC_SPEED_OF_LIGHT * gradient / ( ( receiverDistance + transmitterDistance ) * ( receiverDistance + transmitterDistance ) - linkEndDistance * linkEndDistance ) ; }
Function to calculate gradient of first order relativistic light time correction due to a gravitating point mass.
Function to calculate gradient of first order relativistic light time correction due to a gravitating point mass .