Homogeneous transformation matrix (9)

Kinematics & Universal Numerics
August 19, 2019

A small result about the minimal rotation.

In a previous blog, we claim that, every 3D rotation matrix 𝐒 that has

𝐝=[dxdydz]=[sϕcψsϕsψcϕ] (1)

in its last column is in the form of

𝐒:=𝐒0Rotz(γ)=[sψcϕcψsϕcψ-cψcϕsψsϕsψ-sϕcϕ][cγ-sγsγcγ1]. (2)

What the rotation 𝐒 do is align the z-axis with 𝐝, so that we can perform a basic rotation around 𝐝, that is the new z-axis, by right- (post-) multiplying Rotz(θ). At the end, we revert the aligning operation by right-multiplying 𝐒T.

Note that the angle between the original z-axis and 𝐝 is ϕ, since


However, the rotation angle of 𝐒0 is not exactly ϕ, since

cϕsψ+sψcϕ+cϕ-12=tr(𝐒0)-12. (3)

In fact,


so the rotation angle of 𝐒0 is always not less than ϕ, given that cosϕ is decreasing in ϕ[0,π]. Here we recall that when we convert a rotation matrix 𝐑 into its axis-angle representation, the rotation angle is attained by


What we want to find out is the value of γ, such that the angle of the rotation 𝐒=𝐒0Rotz(γ) parametrized by γ is exactly ϕ. That is

2cϕ+1=tr(𝐒) =(sψcγ+cϕcψsγ)+(cψsγ+cϕsψcγ)+cϕ

Rearranging terms yields

(cϕ+1)(1-sψ+γ)=0. (4)

If cϕ=-1, then ϕ=π and

𝐒 =𝐒0Rotz(γ)=[sψ-cψ-cψ-sψ-1][cγ-sγsγcγ1]=[sψ-γ-cψ-γ-cψ-γ-sψ-γ-1].

Rotating any vector perpendicular to the z-axis by angle π can achieve this, so the simplest choice is ψ-γ=π/2, and


Otherwise, if cϕ-1, then sψ+γ=1 and we can choose γ=π/2-ψ. Then

𝐒=𝐒0Rotz(γ) =[sψcϕcψsϕcψ-cψcϕsψsϕsψ-sϕcϕ][sψ-cψcψsψ1]
=[1+cψ2(cϕ-1)sψcψ(cϕ-1)sϕcψsψcψ(cϕ-1)1+sψ2(cϕ-1)sϕsψ-sϕcψ-sϕsψcϕ]. (5)

When the rotation axis 𝐝 is not trivially [0,0,1]T and hence cϕ1 and sϕ0, the rotation axis of 𝐒 is


always a vector perpendicular to the z-axis.