# QVM: Quaternions, Vectors, Matrices

### Accessing Quaternion Elements

#include <boost/qvm/quat_access.hpp>

    namespace boost
    {
        namespace qvm
        {
            //Only enabled if:
            //  is_quat<Q>::value

            template <class Q> -unspecified-return-type- S( Q & q );
            template <class Q> -unspecified-return-type- V( Q & q );
            template <class Q> -unspecified-return-type- X( Q & q );
            template <class Q> -unspecified-return-type- Y( Q & q );
            template <class Q> -unspecified-return-type- Z( Q & q );
        }
    }

An expression of the form S(q) can be used to access the scalar component of the quaternion q. For example,

    S(q) *= 42;

multiplies the scalar component of q by the scalar 42.

An expression of the form V(q) can be used to access the vector component of the quaternion q. For example,

    V(q) *= 42

multiplies the vector component of q by the scalar 42.

The X, Y and Z elements of the vector component can also be accessed directly using X(q), Y(q) and Z(q).

See also: Boost QVM | boost/qvm/quat_access.hpp | Synopsis