pub fn rotation(q: Quaternion) -> Matrix4 {
        let qx2 = q.x * q.x;
        let qy2 = q.y * q.y;
        let qz2 = q.z * q.z;
        let qxqy = q.x * q.y;
        let qxqz = q.x * q.z;
        let qyqz = q.y * q.z;
        let qwqx = q.w * q.x;
        let qwqy = q.w * q.y;
        let qwqz = q.w * q.z;

        Matrix4 {data: [[1.0 - 2.0 * (qy2 + qz2),     2.0 * (qxqy - qwqz),     2.0 * (qxqz + qwqy), 0.0],
                        [    2.0 * (qxqy + qwqz), 1.0 - 2.0 * (qx2 + qz2),     2.0 * (qyqz - qwqx), 0.0],
                        [    2.0 * (qxqz - qwqy),     2.0 * (qyqz + qwqx), 1.0 - 2.0 * (qx2 + qy2), 0.0],
                        [                    0.0,                     0.0,                     0.0, 1.0]]}
    }
/// Returns a rotation matrix for a `Quaternion`.
Returns a rotation matrix for a `Quaternion`.
Returns a rotation matrix for a ` Quaternion ` .
pub fn rotation(q: Quaternion) -> Matrix4 {
        let qx2 = q.x * q.x;
        let qy2 = q.y * q.y;
        let qz2 = q.z * q.z;
        let qxqy = q.x * q.y;
        let qxqz = q.x * q.z;
        let qyqz = q.y * q.z;
        let qwqx = q.w * q.x;
        let qwqy = q.w * q.y;
        let qwqz = q.w * q.z;
        Matrix4 {data: [[1.0 - 2.0 * (qy2 + qz2),     2.0 * (qxqy - qwqz),     2.0 * (qxqz + qwqy), 0.0],
                        [    2.0 * (qxqy + qwqz), 1.0 - 2.0 * (qx2 + qz2),     2.0 * (qyqz - qwqx), 0.0],
                        [    2.0 * (qxqz - qwqy),     2.0 * (qyqz + qwqx), 1.0 - 2.0 * (qx2 + qy2), 0.0],
                        [                    0.0,                     0.0,                     0.0, 1.0]]}
    }
pub fn rotation ( q : Quaternion ) -> Matrix4 { let qx2 = q . x * q . x ; let qy2 = q . y * q . y ; let qz2 = q . z * q . z ; let qxqy = q . x * q . y ; let qxqz = q . x * q . z ; let qyqz = q . y * q . z ; let qwqx = q . w * q . x ; let qwqy = q . w * q . y ; let qwqz = q . w * q . z ; Matrix4 { data : [ [ 1.0 - 2.0 * ( qy2 + qz2 ) , 2.0 * ( qxqy - qwqz ) , 2.0 * ( qxqz + qwqy ) , 0.0 ] , [ 2.0 * ( qxqy + qwqz ) , 1.0 - 2.0 * ( qx2 + qz2 ) , 2.0 * ( qyqz - qwqx ) , 0.0 ] , [ 2.0 * ( qxqz - qwqy ) , 2.0 * ( qyqz + qwqx ) , 1.0 - 2.0 * ( qx2 + qy2 ) , 0.0 ] , [ 0.0 , 0.0 , 0.0 , 1.0 ] ] } }
Returns a rotation matrix for a `Quaternion`.
Returns a rotation matrix for a ` Quaternion ` .
q
Quaternion
q
Quaternion