Advertisement

quaternion rotations for weighted envelopes?

Started by September 10, 2002 03:02 AM
1 comment, last by jorgander 22 years, 5 months ago
the general problem involves using quaternions to rotate points based on a set of weights (geometric envelopes weighted to articulated chains), and the specific problem is that i''m not sure how to scale a quaternion correctly. for example, if a given joint/bone in an articualted chain is rotated by quaternion Q, then how do i rotate a point that is affected by that bone by the weighted amount (say, %50)? is it enough to multiply either the scalar part or the vector part of the quaternion by the percentage amount??? i.e. is it correct to say Q.w *= .5 or Q.xyz *= .5??? in euler-angle speak, if a joint/bone has rotations of 30 degress x, 60 degrees y, and 90 degrees z, and a point is weighted to it by %50, then it is sufficient to rotate the point around the origin of the bone by 15 degrees x, 30 degrees y, and 45 degrees z. it''s just that i don''t know how to this same thing in quaternions. can anyone help me here???
no rotation in the unit quaternion, with Q.w =0 1 and Q.xyz == 0. The usual way to achieve what you want it to blend/interpolate between this and your final/target quaternion.

There are two main ways to do this: linear and spherical-linear. Linear is just linear interpolation of the quaternion elements. E.g. if quaternion addition, multiplication etc. are defined in the obvious way the formula is

q = q0 + t (q1 - q0)

where t is the interpolation parameter. The resulting quaternion generally needs normalising after this.

Spherical linear is more usually called by its acronym ''SLERP''. It produces a more natural interpolation but is more expensive to calculate. Most quaternion libraries supply a function do it, or you can find it described in any good quaternion reference.

John BlackburneProgrammer, The Pitbull Syndicate
Advertisement
i have already implemented lerp and slerp and i am sure that they work fine. all the envelope points rotate correctly if they are weighted near %100 to a given joint; it is only when they are weighted at close to %50 that they go really crazy (for example, in the knees and elbows).

i use lerp and slerp to interpolate between keyframes for the joint rotations, and there are no problems there so i don't think it's my lerp/slerp implementation. the rotation of a given envelope point will always be between Q0=(1(0,0,0)) (%0) and Q1=(w(x,y,z)) (%100) where Q1 is the joint's current rotation. so, i should be able to just multiply x y and z by the weight and get the correct value, after which i normalize again. at least, i think so.

[edited by - jorgander on September 10, 2002 11:18:51 AM]

This topic is closed to new replies.

Advertisement