General Category > General Anim8or Forum

Conversion of jointangle to quaternion

(1/2) > >>

SomariHater:
I'm trying to figure out how to interpret the joint angles in the sequence section of an8 files. If someone could help me convert the joint angle into a quaternion or a rotation matrix or even XYZ Euler angles, that would be great. (It is okay to assume every keyframe has "X", "Y", and "Z" values for simplicity. I can figure out the interpolation. Also, assume there is just one bone besides the root bone. I can figure out the hierarchy.)

I am trying to reverse engineer it, but I'm getting lost (the an8 spec doesn't say how to interpret the value as far as I can tell). When I set the "Orientation (PYR)" of a bone in figure mode to 0, 45, 45, Anim8or saves a bone orientation quaternion of (0.14645 -0.35355 -0.35355 0.85355) into the figure section of the file. This is what I expect for XYZ Euler angles.

However, if the "Orientation (PYR)" is 0, 0, 0 in figure mode, and I set the "Joint Angles (XYZ)" of a bone in sequence mode to 0, 45, 45, Anim8or displays a very different rotation than figure mode. By manually rotating the bone in sequence mode, I was able to figure out that a "Joint Angle (XYZ)" of 38.5, -61.4, -24.8 produces a similar result to a "Orientation (PYR)" of 0, 45, 45. I attached some pictures to show what I mean.

So, if anyone could help me decode what "Joint Angle (XYZ)" means, that would be awesome. Thanks. Also, if you need more information let me know.

SomariHater:
I found LibAn8 (https://sourceforge.net/p/liban8/code/HEAD/tree/). It looks like it translates a "Joint Angles (XYZ)" of 0, 45, 45 into the quaternion (0.14645 0.35355 0.35355 0.85355). That is the same as how Anim8or translates a "Orientation (PYR)" of 0, 45, 45 except that the Y and Z positions are positive instead of negative.

That means, LibAn8 claims that an "Orientation (PYR)" of 0, 45, 45 is equivalent to a "Joint Angles (XYZ)" of 0, -45, -45 even though they give different  results in Anim8or. I'm still confused.

Raxx:
Have you looked at Steve's writeup here? http://www.anim8or.com/learn/technical/quaternions_and_anim8or/quaternions_and_anim8or.htm This topic has also been brought up a lot in the forums, you may find the answer to what you're looking for in the search results here.

SomariHater:
Yes. I read that, and I've read similar posts like this one: http://www.anim8or.com/smf/index.php/topic,4861.msg35328.html#msg35328. However,  it seems like the writeup doesn't answer this question, and an answer was never determined in that other post.

The angles in figure mode match the writeup and match what I expect for euler angles. For instance, if I increase the "yaw" or angle about the y axis in figure mode, when viewed from the top, the object spins clockwise (which is consistent with the "simple Euler rotations" in the writeup).

However, sequence mode isn't behaving like I expect. For instance, if I increase the angle about the y axis in sequence mode, when viewed from the top, the figure spins counter-clockwise.

In figure mode, if I apply a Y angle of 45 degrees, and a Z angle of 45 degrees, when viewed from the top, the object tilts to the bottom right.

In sequence mode, if I apply a Y angle of 45 degrees, and a Z angle of 45 degrees, when viewed from the top, the object tilts left with a twist.

I'm probably making a stupid mistake somewhere, but the angles don't seem to mean the same thing in figure and sequence mode. I think if the writeup showed how the axes moved in sequence mode and the order of the rotations, then I could understand better.

Steve:
The convention that Anim8or uses is:

Looking down an axis in the negative direction, a positive rotation turns clockwise. Some applications do the opposite. Here is a simple axis model and a drawing:

Navigation

[0] Message Index

[#] Next page

Go to full version