Asked by:
Moving from OpenNI  how to get a joint transformation
Question

Hi,
I would prefer to use the official SDK, but it doesn't seem to have a way to get a joint's transformation  something that is very useful when trying to map to a 3D avatar. Does anyone have any suggestions on how to convert the Point that I get from the official SDK to a Transformation?
Thanks,
Marc
All replies

Identify two adjacent joints and calculate the angle between both vectors.
 Proposed as answer by Erik Kramer Tuesday, March 20, 2012 8:22 AM
 Unproposed as answer by Erik Kramer Tuesday, March 20, 2012 8:22 AM

Hi Erik,
Thanks for the reply.
Do you know of any examples? I understand in principle what you're saying  but can't see in my mind how I would go about coding it. For example, how would I take into account the rotation of the body, and which axis would I be measuring the angle on?
Thanks again
Marc

Assuming the user can't move his left hip independently from his right hip, you can get the yaxis rotation of the body from the left and right hip joint positions. From the top of my head that would be something like angle = asin((hipleft.z  hipright.z) / (hipleft.x  hipright.x)).
Unfortunately I don't have an example, but I can be a bit more verbose about this:
I realize that some additional calculation is required to get the joint's rotations. If you calculate the angle between two length vector3's ( J  Adj. J1 and J  Adj. J2) the result will of course be the angle in the plane between the three positional vector3's. So you'll need the angle with another reference point to determine the normal vector of the plane. I'd suggest using the kinect plane's normal vector to do this. That would be V(0, 0, 1) if the user is not rotated around his xaxis.
Since the dotproduct of the normalized length vectors returns the cosine of the angle, you'll also need to do some extra calculating to work out the "sign" of the angle. This is trivial though.
Good luck!
Erik
 Edited by Erik Kramer Thursday, December 15, 2011 9:42 PM added brackets
 Proposed as answer by ykbharat Sunday, May 6, 2012 12:45 PM
