Limiting rotation with quaternions
Is there a way to check if a quaternion is within certain limit of rotation? Say I want to make a bone structure, and joints of a skeleton are pretty limited in their range of motion. Is it possible to define bounds and make sure certain orientations are within them?
___________________________________Digital Paint: Paintball 2.0jitspoe's joint
You can do the quaternion inner product to determine how far apart two quaternions are in their 4D rotation space, and use that to limit them to a range. But there''s no simple relationship between this 4D space and the 3D space in which the rotations operate, so this is unlieky to correspond in an obvious way to the bone geometry.
Another way is to pick a vector and apply the rotation to it, and see whether this is within bounds. The input vector should be one relevent to the problem, e.g. the axis between two joints in a bone, and the output of it can be tested against appropriate bounds for the motion of that bone.
If it exceeds those bounds you could just move back a timestep to a valid rotation, if one exists. Or use SLERP or some other form of interpolation to pick a rotation between the problem one and a known good one, which can be tested and further refined if necessary.
Another way is to pick a vector and apply the rotation to it, and see whether this is within bounds. The input vector should be one relevent to the problem, e.g. the axis between two joints in a bone, and the output of it can be tested against appropriate bounds for the motion of that bone.
If it exceeds those bounds you could just move back a timestep to a valid rotation, if one exists. Or use SLERP or some other form of interpolation to pick a rotation between the problem one and a known good one, which can be tested and further refined if necessary.
John BlackburneProgrammer, The Pitbull Syndicate
June 07, 2002 02:06 AM
I just did this problem a few months ago in my column for Game Developer Magazine, "The Inner Product". Look for the April 2002 issue.
I think the article was called "Inverse Kinematics with Joint Limits" or something.
There is source code implementing the joint limit scheme on www.gdmag.com/code.htm.
You can do the quaternion dot product as johnb suggests, but yeah, this doesn''t actually give you anything meaningful. What I did was define joint limits in terms of "reach" and "twist", then showed how to quickly do quaternion operations that clamp each of these.
-Jonathan.
I think the article was called "Inverse Kinematics with Joint Limits" or something.
There is source code implementing the joint limit scheme on www.gdmag.com/code.htm.
You can do the quaternion dot product as johnb suggests, but yeah, this doesn''t actually give you anything meaningful. What I did was define joint limits in terms of "reach" and "twist", then showed how to quickly do quaternion operations that clamp each of these.
-Jonathan.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement