namespace glm { template GLM_FUNC_QUALIFIER T dot(qua const& x, qua const& y) { GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'dot' accepts only floating-point inputs"); return detail::compute_dot, T, detail::is_aligned::value>::call(x, y); } template GLM_FUNC_QUALIFIER T length(qua const& q) { return glm::sqrt(dot(q, q)); } template GLM_FUNC_QUALIFIER qua normalize(qua const& q) { T len = length(q); if(len <= static_cast(0)) // Problem return qua(static_cast(1), static_cast(0), static_cast(0), static_cast(0)); T oneOverLen = static_cast(1) / len; return qua(q.w * oneOverLen, q.x * oneOverLen, q.y * oneOverLen, q.z * oneOverLen); } template GLM_FUNC_QUALIFIER qua cross(qua const& q1, qua const& q2) { return qua( q1.w * q2.w - q1.x * q2.x - q1.y * q2.y - q1.z * q2.z, q1.w * q2.x + q1.x * q2.w + q1.y * q2.z - q1.z * q2.y, q1.w * q2.y + q1.y * q2.w + q1.z * q2.x - q1.x * q2.z, q1.w * q2.z + q1.z * q2.w + q1.x * q2.y - q1.y * q2.x); } }//namespace glm