PDA

View Full Version : SLERP - Quaternion Interpolation



Bunkai.Satori
02-07-2011, 01:12 PM
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.

Alfonse Reinheart
02-07-2011, 02:06 PM
If you're talking about GLM, it's available as an overload of the "mix" function.

Bunkai.Satori
02-07-2011, 02:26 PM
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.

Alfonse Reinheart
02-07-2011, 02:54 PM
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.

Bunkai.Satori
02-07-2011, 03:49 PM
Ah, I will have to include Quaternions extenstion of GLM. Thank you very much. I am happy to have SLERP.

carsten neumann
02-07-2011, 03:59 PM
//! 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.

Bunkai.Satori
02-07-2011, 04:59 PM
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.

Alfonse Reinheart
02-07-2011, 06:39 PM
It does SLERPing. You can see it in the implementation, regardless of what the documentation says.

Groovounet
02-08-2011, 02:31 AM
Yes, it's a documentation error.

Bunkai.Satori
02-08-2011, 04:29 AM
Thanks folks.