pub fn rotation<T: Copy + NumAssign>(q: Quaternion<T>) -> Mat4<T>
Expand description

Creates a 4x4 transformation matrix that represents a rotation by a quaternion.

Examples

assert_float_eq!(
    transform::rotation(quat(1./3_f32.sqrt(), 1./3_f32.sqrt(), 1./3_f32.sqrt(), 0.)).as_ref(),
    &[-1./3., 2./3., 2./3., 0., 2./3., -1./3., 2./3., 0., 2./3., 2./3., -1./3., 0., 0., 0., 0., 1.]
);