Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

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.