Tudat/Mathematics/BasicMathematics/rotationAboutArbitraryAxis.cpp
//! Compute rotation of point about arbitrary axis
Compute rotation of point about arbitrary axis
Compute rotation of point about arbitrary axis
Eigen::Vector3d computeRotationOfPointAboutArbitraryAxis(
        const Eigen::Vector3d& originOfRotation,
        const double angleOfRotation,
        const Eigen::Vector3d& axisOfRotation,
        const Eigen::Vector3d& initialPositionOfPoint )
{
    Eigen::Matrix3d rotationMatrix = Eigen::Matrix3d::Zero( );
    rotationMatrix = Eigen::AngleAxisd( angleOfRotation, axisOfRotation.normalized( ) );
    const Eigen::Vector3d initialPositionOfPointWithRespectToOriginOfRotation =
            initialPositionOfPoint - originOfRotation;
    const Eigen::Vector3d rotatedPositionWithRespectToOriginOfRotation =
            rotationMatrix * initialPositionOfPointWithRespectToOriginOfRotation;
    return rotatedPositionWithRespectToOriginOfRotation + originOfRotation;
}
Eigen :: Vector3d computeRotationOfPointAboutArbitraryAxis ( const Eigen :: Vector3d & originOfRotation , const double angleOfRotation , const Eigen :: Vector3d & axisOfRotation , const Eigen :: Vector3d & initialPositionOfPoint ) { Eigen :: Matrix3d rotationMatrix = Eigen :: Matrix3d :: Zero ( ) ; rotationMatrix = Eigen :: AngleAxisd ( angleOfRotation , axisOfRotation . normalized ( ) ) ; const Eigen :: Vector3d initialPositionOfPointWithRespectToOriginOfRotation = initialPositionOfPoint - originOfRotation ; const Eigen :: Vector3d rotatedPositionWithRespectToOriginOfRotation = rotationMatrix * initialPositionOfPointWithRespectToOriginOfRotation ; return rotatedPositionWithRespectToOriginOfRotation + originOfRotation ; }
Compute rotation of point about arbitrary axis
Compute rotation of point about arbitrary axis
//Declare and initialize rotation matrix // Compute rotation matrix using AngleAxis object. // Compute initial of position of point with respect to origin of rotation. // Compute rotation of point about axis of rotation with respect to origin of rotation. //Return position with respect to the chosen arbitrary origin after rotation about //arbitrary axis.