SLERP - Quaternion Interpolation

Dear all,

Is Quaternion Interpolation (SLERP) function available in (GLM)GLMath? I simply can not find it. In my opinion, it is quite necesary function. If it not yet present, I would strongly vote for implementing it.

If you’re talking about GLM, it’s available as an overload of the “mix” function.

Hi Alfonse,

yes, I was talking about GLM. Would you be so kind to tell me where to find that “mix” function? I discovered GLM today, so probably, I do not know yet, where is what I need. Thanks.

Would you be so kind to tell me where to find that “mix” function?

It’s defined in the same file you include to get access to quaternions. Like all GLM types and functions, it is defined in the “glm” namespace.

Ah, I will have to include Quaternions extenstion of GLM. Thank you very much. I am happy to have SLERP.


//! Returns a LERP interpolated quaternion of x and y according a. 
//! From GLM_GTC_quaternion extension.

    template <typename T> 
    detail::tquat<T> mix(
        detail::tquat<T> const & x, 
        detail::tquat<T> const & y, 
        typename detail::tquat<T>::value_type const & a);

unless I’m missing something (quite possible I’m not using GLM) it only does a lerp not slerp.

Hi Carsten,

thank you very much for your information. Well, I would appreciate SLERP instead of LERP, as SLERP should provide better smoothnes.

Thank you very much, indeed.

It does SLERPing. You can see it in the implementation, regardless of what the documentation says.

Yes, it’s a documentation error.

Thanks folks.