axis_angle_rotation_to_rotation_matrix Subroutine

public pure subroutine axis_angle_rotation_to_rotation_matrix(k, theta, rotmat)

Computes the rotation matrix that corresponds to a rotation about the axis k by an angle theta.

Arguments

Type IntentOptional Attributes Name
real(kind=wp), intent(in), dimension(3) :: k

rotation axis

real(kind=wp), intent(in) :: theta

rotation angle [rad]

real(kind=wp), intent(out), dimension(3,3) :: rotmat

rotation matrix


Calls

proc~~axis_angle_rotation_to_rotation_matrix~~CallsGraph proc~axis_angle_rotation_to_rotation_matrix vector_module::axis_angle_rotation_to_rotation_matrix proc~cross_matrix vector_module::cross_matrix proc~axis_angle_rotation_to_rotation_matrix->proc~cross_matrix proc~unit vector_module::unit proc~axis_angle_rotation_to_rotation_matrix->proc~unit

Called by

proc~~axis_angle_rotation_to_rotation_matrix~~CalledByGraph proc~axis_angle_rotation_to_rotation_matrix vector_module::axis_angle_rotation_to_rotation_matrix proc~vector_test vector_module::vector_test proc~vector_test->proc~axis_angle_rotation_to_rotation_matrix

Source Code

    pure subroutine axis_angle_rotation_to_rotation_matrix(k,theta,rotmat)

    implicit none

    real(wp),dimension(3),intent(in)    :: k        !! rotation axis
    real(wp),intent(in)                 :: theta    !! rotation angle [rad]
    real(wp),dimension(3,3),intent(out) :: rotmat   !! rotation matrix

    real(wp),dimension(3,3),parameter :: I = &
            reshape([one,zero,zero,zero,one,zero,zero,zero,one],[3,3]) !! 3x3 identity matrix

    real(wp),dimension(3,3) :: w
    real(wp),dimension(3) :: khat
    real(wp) :: ct,st

    ct = cos(theta)
    st = sin(theta)
    khat = unit(k)
    w  = cross_matrix(khat)

    rotmat = I + w*st + matmul(w,w)*(one-ct)

    end subroutine axis_angle_rotation_to_rotation_matrix