0
\$\begingroup\$

I've been trying to implement dual quaternions for a bone system and I have a few questions about them. I started by reading the beginners guide to dual quaternions (link: http://wscg.zcu.cz/wscg2012/short/A29-full.pdf) that was posted a number of times on this site already but I'm looking for some clarification.

I know that for a single quaternion q, I can apply a rotation to a point p by doing: p'= qpp.conjugate

But the dual part of the quaternion that represents the translation isn't a unit quaternion itself. So how do I directly apply it to a point without first transforming it to a matrix?

The paper has a function called getTranslation that they use to insert it in to the matrix. When I call this function in my code the translation vector I get back is different than the one I put in to the dual quaternion. This seems strange to me but I guess it makes sense since it appears that when you insert the translation vector, you immediately apply the rotation quaternion to it. I want to get a better foundational understanding before moving on to applying the quaternions in a large skeleton. But I feel like I can't even get the translational part of the root correct.

Here is how I am creating the dual quaternion:

math::dualQuaternion::dualQuaternion(quat rotation, v3 translation)
{
    this->rotation = rotation.normalized();
    quat q = (quat(0.f, translation.x(), translation.y(), translation.z()) * this->rotation);
    this->translation = quat(0.f, q.x()*0.5f, q.y()*0.5f, q.z()*0.5f);
}

Here is my function for extracting the translation part (removing normalization has no effect here either):

v3 math::dualQuaternion::getTranslation()
{    
    dualQuaternion dq = dualQuaternion(this->rotation, this->translation);
    dq.normalize();

    quat t = dq.translation;
    quat o = quat(t.w()*2.f, t.x()*2.f, t.y()*2.f, t.z()*2.f)*this->rotation.conjugate();

    return v3(o.x(), o.y(), o.z());
}

when I apply the transform to a point I am trying to call getTranslation and doing:

newPoint = getTranslation() + dq.rotation*oldPoint*dq.rotation.conjugate()

Any help would be appreciated.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.