Jump to content
  • Advertisement
Sign in to follow this  
chand81

Concatenating transformation represented by Quaternion and Vector

This topic is 3782 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have two transformations represented by a quaternion (rotation) followed by a vector (translation). That is, a rotation followed by a translation. T1 = [q1,t1] T2 = [q2,t2] I wish to compute a composite transformation T3 that is equivalent to T1 followed by T2 T3 = T2 * T1 T3 = [q3,t3] How to compute q3 and t3 in an efficient manner? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
Is it correct that you're looking for the composition of a piecewise transformation, where each step is given by a rotation and positioning? If so, do you want to perform the rotations each one in the local co-ordinate frame, or do you want to perform it in the world frame at the particular current position (i.e. influenced by all formerly done translations)?

In the latter case I suggest to use homogeneous matrices and the appropriate matrix product, e.g. (for column vectors)
M := T(t2) * R(q2) * T(t1) * R(q1)
You can decompoe the result into q3 and t3 if you really need to do so.

In the former case you can use matrices, too, but you can also stay with (unit) quaternions and translation vectors, since the locality separates the 2 kinds of transformations:
q3 = fq(q1,q2)
t3 = ft(t1,t2)

Share this post


Link to post
Share on other sites
Application: Vertex Skinning (Sorry, should have mentioned this earlier)
Keys for each bone are defined in the parent bones space as an orientation [quat] and position [point3]. Only exception being the root bone, its keys are defined in the Mesh space.

E.g. Mesh->Bone0->Bone1

Before I can do actual vertex skinning, I need all the bones to be in Mesh space.
In the above example, Bone0 is already in mesh space, for Bone1 one only needs to multiply its transformation by that of Bone0.

Bone0TM = Bone1TM * Bone0TM

All TM's are of the form [quat, vec]. This is straight forward if the [quat,vec] representation is converted to matrix form, but it will be too expensive. Can this multiplication be done in a more efficient manner?

Thanks

Share this post


Link to post
Share on other sites
This implies that you only need compute the quaternion multiplications (no convertion to matrix)
q3 = q2 * q1
And if i'm doing the math right, t3 = q1 * t2 + t1


where you can compute q2 * q1 with the operator overload

inline Quat operator*( const Quat &Q1, const Quat &Q2 )
{
const float x = Q1.w * Q2.x + Q1.x * Q2.w + Q1.y * Q2.z - Q1.z * Q2.y;
const float y = Q1.w * Q2.y - Q1.x * Q2.z + Q1.y * Q2.w + Q1.z * Q2.x;
const float z = Q1.w * Q2.z + Q1.x * Q2.y - Q1.y * Q2.x + Q1.z * Q2.w;
const float w = Q1.w * Q2.w - Q1.x * Q2.x - Q1.y * Q2.y - Q1.z * Q2.z;
return Quat( x, y, z, w );
}


Share this post


Link to post
Share on other sites
Quote:
Original post by KulSeran
This implies that you only need compute the quaternion multiplications (no convertion to matrix)
q3 = q2 * q1
And if i'm doing the math right, t3 = q1 * t2 + t1


where you can compute q2 * q1 with the operator overload
*** Source Snippet Removed ***


Yes, actually I just thought of this (paper and pen :)
I will need to try it out to confirm.
Thanks for your input.

Share this post


Link to post
Share on other sites
In the latter case I suggest to use homogeneous matrices and the appropriate matrix product, e.g. (for column vectors)
M := T(t2) * R(q2) * T(t1) * R(q1)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!