QVM: Quaternions, Vectors, Matrices

convert_to(quat)

#include <boost/qvm/quat_operations.hpp>

namespace boost
{
    namespace qvm
    {
        //Only enabled if:
        //  is_quat<R>::value && is_quat<A>::value
        template <class R,class A>
        R convert_to( A const & a );
        
        //Only enabled if:
        //  is_quat<R>::value && is_mat<A>::value &&
        //  mat_traits<A>::rows==3 && mat_traits<A>::cols==3
        template <class R,class A>
        R convert_to( A const & m );
    }
}

Requirements:

R must be copyable.

Effects:

The first overload is equivalent to: R r; assign(r,a); return r;

The second overload assumes that m is an orthonormal rotation matrix and converts it to a quaternion that performs the same rotation.