1

I'm working on a wpf application using kinect for windows sdk ver 1.5 in which the joints orientation is supported. I calculated the angles between the skeleton joints in which the angle is calculated based on the parent bone as shown in the attached images, the problem is that the angle is calculated without a sign determining its direction whether its upwards "+ve" or "-ve" downwards, and I need to detect this or put a sign for example +ve if upwards and -ve if downwards, As shown in the attached pics the first pic shows the angle = 4, then if i moved upwards the angle will be 45 and if i moved downwards the angle will be 48 not -48, all what i need to know is how to differentiate and the direction of movement in which the angle will be +angle if upwards and -ve angle if downwards. here is the link of the images"you need to press next to the three pics"

http://imageshack.us/photo/my-images/267/64483060.png

Many thanks

Tak
  • 3,536
  • 11
  • 51
  • 93

2 Answers2

0

Calculate the cross product. The sign of the cross product will give you the direction.

Sumeet Jindal
  • 882
  • 1
  • 7
  • 16
  • how to calculate the cross product while i'm using the sdk function which gives the orientation of the joint? i mean its a built in function, i;m not calculating it as two vectors,.. – Tak Jun 29 '12 at 22:01
  • Calculate cross product between the direction vector of the joints. Direction vector = JointPosition - parentJoinPosition – Sumeet Jindal Jul 02 '12 at 05:34
  • ok, so for example if the shoulder right is positioned in x,y,z (10,10,10) and the right elbow positioned in (20,20,20), what shall i do? many thanks – Tak Jul 05 '12 at 01:15
  • Shoulder Direction =[ (20,20,20) - (10,10,10) ].Normalize(). Arm Direction =[ Hand Position - (20,20,20) ].Normalize(). Take cross product of these – Sumeet Jindal Jul 05 '12 at 03:34
0

You should provide us some code to see what is wrong. Did you used Math.Atan? Maybe you should use Math.Atan2 instead. There are some range differences between those two. Take a look:

http://en.wikipedia.org/wiki/Arctangent

http://en.wikipedia.org/wiki/Atan2