The affine/rotation matrix \(R\) is calculated from the quaternion parameters.
quaternion2rotation(b, c, d, tol = 1e-07)
quaternion2mat44(nim, tol = 1e-07)
b | is the quaternion \(b\) parameter. |
---|---|
c | is the quaternion \(c\) parameter. |
d | is the quaternion \(d\) parameter. |
tol | is a very small value used to judge if a number is essentially zero. |
nim | is an object of class |
The (proper) \(3{\times}3\) rotation matrix or \(4{\times}4\) affine matrix.
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^2+b^2+c^2+d^2=1\). The
\((b,c,d)\) values are all that is needed, since we require that
\(a=[1-(b^2+c^2+d^2)]^{1/2}\) be non-negative.
The \((b,c,d)\) values are stored in the (quatern_b
,
quatern_c
, quatern_d
) fields.
NIfTI-1
http://nifti.nimh.nih.gov/
Brandon Whitcher bwhitcher@gmail.com
## 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 <- quaternion2rotation(1, 0, 0))
#> [,1] [,2] [,3]
#> [1,] 1 0 0
#> [2,] 0 -1 0
#> [3,] 0 0 -1