ofNode and ofVec3f for tracking

I am using the ofxNi2 addon which conveniently maps skeletal objects as ofNode. Using this, I am trying to get some interesting tracking results such as the angle between left arm and right knee, etc. Since each element is a node, I just say joint.getGlobalPosition which of course returns an ofVec3f- and I am trying to get the angle between two such global positions (ofVec3f hand.angleRad(knee).

But for whatever reason, whether I get degrees or radians of the angle, no matter how I position myself it does not exceed 10 degrees. In short I wanted to know how the angle method works on ofVec3f since there is no extensive documentation on that beyond a line- and I don’t know where to look.

Could someone please help me explain how the angle method works within this?

Thanks.

hi. you might have a confusion about how angles are measured. You need 3 points to get an angle out of it. with 2 you just get a single line. It is not an OF specific thing it is just vector math.

In the case of ofVec3f angle method it assumes that the third point is the origin (0,0). so, the value you are getting is the angle between the line that goes from origin to knee and the line from origin to hand.

Thus, if you want to use a different origin you can do as follows:

ofVec3f origin(100,100, 100);// whatever value you want.
(hand - origin).angleRad(knee - origin);

Of course that makes sense.

I just did not understand what it meant by angle, like you said, as you would need 3 co-ordinates, and I could not find any method that accepts 3.

Would you happen to know a method for glm::vecn and not ofVec?
Perhaps I could use subtraction like you did in vec3f

Thank you!

yes, in glm it is glm::angle(vec, vec) which returns the angle. and you would need to do the same subtraction thing.