quaternion2rotation: Convert Quaternion into a Rotation Matrix
Description
The rotation matrix $R$ is calculated from the quaternion
parameters.
Usage
quaternion2rotation(b, c, d)
Arguments
b
is the quaternion $b$ parameter.
c
is the quaternion $c$ parameter.
d
is the quaternion $d$ parameter.
Value
The (proper) 3x3 rotation matrix.
Details
The quaternion representation is chosen for its compactness in
representing rotations. The orientation of the (x,y,z) axes relative
to the (i,j,k) axes in 3D space is specified using a unit quaternion
[a,b,c,d], where a*a+b*b+c*c+d*d=1. The (b,c,d) values are all that
is needed, since we require that a = sqrt(1.0-(b*b+c*c+d*d)) be
nonnegative. The (b,c,d) values are stored in the
(quatern_b,quatern_c,quatern_d) fields.
R <- quaternion2rotation(1, 0, 0)
## This R matrix is represented by quaternion [a,b,c,d] = [0,1,0,0]## (which encodes a 180 degree rotation about the x-axis).R