Dual-Quaternion-Skinning-Sample-Codes
Dual-Quaternion-Skinning-Sample-Codes copied to clipboard
dual_quat_cu.hpp to_transformation
Hi, was looking at your example for getting the transformation from the dual quaternion:
Transfo to_transformation()
{
Vec3 t;
float norm = _quat_0.norm();
// Rotation matrix from non-dual quaternion part
Mat3 m = (_quat_0 / norm).to_matrix3();
// translation vector from dual quaternion part:
t.x = 2.f*(-_quat_e.w()*_quat_0.i() + _quat_e.i()*_quat_0.w() - _quat_e.j()*_quat_0.k() + _quat_e.k()*_quat_0.j()) / norm;
t.y = 2.f*(-_quat_e.w()*_quat_0.j() + _quat_e.i()*_quat_0.k() + _quat_e.j()*_quat_0.w() - _quat_e.k()*_quat_0.i()) / norm;
t.z = 2.f*(-_quat_e.w()*_quat_0.k() - _quat_e.i()*_quat_0.j() + _quat_e.j()*_quat_0.i() + _quat_e.k()*_quat_0.w()) / norm;
return Transfo(m, t);
}
Shouldn't you have to divide the translation vector by norm square instead of just norm, as you have to normalise the dual quaternion first?