Creates active rotation matrix for z-y'-x" rotation given Tait-Bryan angles
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=Float64), | intent(in) | :: | alpha | Angle of rotation about z |
||
real(kind=Float64), | intent(in) | :: | beta | Angle of rotation about y' |
||
real(kind=Float64), | intent(in) | :: | gamma | Angle of rotation about x" |
||
real(kind=Float64), | intent(out), | dimension(3,3) | :: | basis | Rotation matrix/basis for transforming from rotated to non-rotated coordinates |
|
real(kind=Float64), | intent(out), | optional | dimension(3,3) | :: | inv_basis | Inverse basis for reverse transformation |
subroutine tb_zyx(alpha, beta, gamma, basis, inv_basis)
!+ Creates active rotation matrix for z-y'-x" rotation given Tait-Bryan angles
real(Float64), intent(in) :: alpha
!+ Angle of rotation about z
real(Float64), intent(in) :: beta
!+ Angle of rotation about y'
real(Float64), intent(in) :: gamma
!+ Angle of rotation about x"
real(Float64), dimension(3,3), intent(out) :: basis
!+ Rotation matrix/basis for transforming from rotated to non-rotated coordinates
real(Float64), dimension(3,3), intent(out), optional :: inv_basis
!+ Inverse basis for reverse transformation
real(Float64) :: sa, sb, sg, ca, cb, cg
sa = sin(alpha) ; sb = sin(beta) ; sg = sin(gamma)
ca = cos(alpha) ; cb = cos(beta) ; cg = cos(gamma)
basis(1,1) = ca*cb ; basis(1,2) = ca*sb*sg - cg*sa ; basis(1,3) = sa*sg + ca*cg*sb
basis(2,1) = cb*sa ; basis(2,2) = ca*cg + sa*sb*sg ; basis(2,3) = cg*sa*sb - ca*sg
basis(3,1) = -sb ; basis(3,2) = cb*sg ; basis(3,3) = cb*cg
if(present(inv_basis)) inv_basis = transpose(basis)
end subroutine tb_zyx