The MS kinect sdk provides both rotation (quaternion) matrix and 3D coordinates. I want to understand how these rotation (quaternion) matrices are computed from the 3D coordinates. Could anyone help me with that? Thanks.

Calculating the joints have been discussed before, but keep in mind, if the user is not facing the camera directly, you have to take that into account.