fn mat_from_quats<T: Float>(q: &Quaternion<T>, r: &Quaternion<T>) -> Matrix<T> {
    Matrix::from_iterator(
        4,
        4,
        // q, q * i, q * j, q * k.
        array::IntoIter::new([
            *q,
            [q.w, q.k, -q.j, -q.i].into(),
            [-q.k, q.w, q.i, -q.j].into(),
            [q.j, -q.i, q.w, -q.k].into(),
        ])
        .map(|q| {
            let arr = (q * r).coords.data.0[0];
            array::IntoIter::new([arr[3], arr[0], arr[1], arr[2]])
        })
        .flatten(),
    )
}
/// Converts a quaternion into a matrix, depending on whether it's a left or
/// right quaternion multiplication.
Converts a quaternion into a matrix, depending on whether it's a left or
right quaternion multiplication.
Converts a quaternion into a matrix depending on whether it ' s a left or right quaternion multiplication .
fn mat_from_quats<T: Float>(q: &Quaternion<T>, r: &Quaternion<T>) -> Matrix<T> {
    Matrix::from_iterator(
        4,
        4,
        // q, q * i, q * j, q * k.
        array::IntoIter::new([
            *q,
            [q.w, q.k, -q.j, -q.i].into(),
            [-q.k, q.w, q.i, -q.j].into(),
            [q.j, -q.i, q.w, -q.k].into(),
        ])
        .map(|q| {
            let arr = (q * r).coords.data.0[0];
            array::IntoIter::new([arr[3], arr[0], arr[1], arr[2]])
        })
        .flatten(),
    )
}
fn mat_from_quats < T : Float > ( q : & Quaternion < T > , r : & Quaternion < T > ) -> Matrix < T > { Matrix :: from_iterator ( 4 , 4 , // q, q * i, q * j, q * k. array :: IntoIter :: new ( [ * q , [ q . w , q . k , - q . j , - q . i ] . into ( ) , [ - q . k , q . w , q . i , - q . j ] . into ( ) , [ q . j , - q . i , q . w , - q . k ] . into ( ) , ] ) . map ( | q | { let arr = ( q * r ) . coords . data . 0 [ 0 ] ; array :: IntoIter :: new ( [ arr [ 3 ] , arr [ 0 ] , arr [ 1 ] , arr [ 2 ] ] ) } ) . flatten ( ) , ) }
Converts a quaternion into a matrix, depending on whether it's a left or
right quaternion multiplication.
Converts a quaternion into a matrix depending on whether it ' s a left or right quaternion multiplication .
q
&Quaternion<T>
r
&Quaternion<T>
q
&Quaternion<T>
r
&Quaternion<T>