Archived

This topic is now archived and is closed to further replies.

Limiting rotation with quaternions

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

Recommended Posts

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?

Share on other sites
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.

Share on other sites
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.

1. 1
Rutin
45
2. 2
3. 3
4. 4
5. 5

• 11
• 9
• 12
• 10
• 13
• Forum Statistics

• Total Topics
632986
• Total Posts
3009725
• Who's Online (See full list)

There are no registered users currently online

×