C++ Glm四元数slerp

C++ Glm四元数slerp,c++,opengl,C++,Opengl,我正在尝试使用glm中的四元数进行slerp。 我正在使用 glm::quat interpolatedquat = quaternion::mix(quat1,quat2,0.5f) 这些是我添加的库 #include <glm/gtc/quaternion.hpp> #include <glm/gtx/quaternion.hpp> #include <glm/gtx/euler_angles.hpp> #include <glm/gtx/norm

我正在尝试使用glm中的四元数进行slerp。 我正在使用

glm::quat interpolatedquat = quaternion::mix(quat1,quat2,0.5f)
这些是我添加的库

#include <glm/gtc/quaternion.hpp>
#include <glm/gtx/quaternion.hpp>
#include <glm/gtx/euler_angles.hpp>
#include <glm/gtx/norm.hpp>
#include <glm\glm.hpp>
#include <glm\glm\glm.hpp>
using namespace glm;
#包括
#包括
#包括
#包括
#包括
#包括
使用名称空间glm;
但我不能让它工作。我加上了所有的glm四元数


错误是“四元数”必须是类名或命名空间。

在GLM 0.9.4.6中搜索
命名空间四元数
四元数::
只在
gtc/quaternion.hpp
中生成一行已注释掉的内容。所有公共GLM功能都直接在
GLM
命名空间中实现。实现详细信息存在于
glm::detail
中,偶尔也存在于
glm::\u detail
中,但是您不应该直接使用这些名称空间中的任何内容,因为它们在将来的版本中可能会发生更改

不使用每个模块/扩展的子名称空间。因此,您只需要:

glm::quat interpolatedquat = glm::mix(quat1,quat2,0.5f)
你可能想在结尾加个分号

编辑:您可能还希望使用
glm::slerp
而不是
glm::mix
,因为它有一个额外的检查,以确保采用最短路径:

// If cosTheta < 0, the interpolation will take the long way around the sphere. 
// To fix this, one quat must be negated.
if (cosTheta < T(0))
{
    z        = -y;
    cosTheta = -cosTheta;
}
//如果cosTheta<0,插值将绕球体走很长一段路。
//要解决此问题,必须对一个四分之一求反。
if(cosTheta

这在
mix
版本中不存在,该版本在其他方面相同。

“无法使其工作”…是否存在故障?删除你的主目录?@genpfault嘿,抱歉,我添加了错误getting@genpfault我试过glm::但似乎无法解决它