joint rotations into angles? C++

joint rotations into angles? C++

• Tuesday, July 24, 2012 9:41 AM

i am woundering how it is possible to calcullate the joint rotation  in euler angles.

the sdk provides the joint rotations in hirarchial and absolute format but i would like to have the joint rotations in angle degrees.

is there a simple appproach how to do it in c++?

the code to get the hirerchial rotation data:

void getVector(const Vector4& v)
{

r[0][2]=v.z;
r[0][0]=v.x;
r[0][1]=v.y;

}

void getMatrix(const Matrix4& m)
{
xy=m.M21;
xx=m.M11;
xz=m.M31;
yz=m.M32;
zz=m.M33;

}

getVector(leftUpperArm.hierarchicalRotation.rotationQuaternion);

getMatrix(leftUpperArm.hierarchicalRotation.rotationMatrix);

would be great someone could give me a code in c++ how to calculate the angles out of this data, if there a simlpe way is existing.

thanks a lot in advance for everyone trying

All Replies

• Thursday, August 02, 2012 8:13 PM
Owner

Here's an answer I got from a co-worker familiar with the subject:

Although conceptually easier to understand, Euler angles are not recommended for general use due to the gimbal lock/singularity problem.

Find a Matrix->Euler or Quaternion->Euler conversion (such as the following link), and then perform a radians to degrees conversion on the result.

http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm

Understand that there are a number of different Euler angle orderings as well, and each is calculated differently. For the conversion above, use the standard one defined on the site (http://www.euclideanspace.com/maths/standards/index.htm).

John K4W Dev

• Sunday, August 26, 2012 3:51 PM

I want to confirm the rotation order of the Rotation Matrix given in the BoneOrientations[JointType].HierarchicalRotation.Matrix

After reading the above links, the standard rotation order is first about Y-axis, then Z-axis, and finally the X-axis.

Since matrix multiplcation does not commute, the order of the axes which one rotates about will affect the result, my question is, being R a rotation matrix given by the Kinect, is this correct:

R = Rx Rz Ry

Thanks.