I have just working on kinect and C# programming so I am very amateur at it I would like to know about joint angles.
I created this code just to test my skill without using kinect but am having trouble with the code.
I supposed vector3 v1
and vector3 v2
as a joint replacement but the value return from Find_angle
is NaN
.
Am I missing something in the process? Please any help in this regard will be helpful.
Vector3 V1 = new Vector3(100,40,90);
Vector3 v2 = new Vector3(160,60,90);
public MainWindow()
{
InitializeComponent();
Vector3.Normalize(V1);
Vector3.Normalize(v2);
float Result = this.find_angle(V1,v2);
MessageBox.Show(Result.ToString());
}
public float find_angle(Vector3 va, Vector3 vb)
{
float dot_pro=Vector3.Dot(va, vb);
double angle = Math.Acos(dot_pro);
angle = angle * 180 / Math.PI;
return (float)(angle);
}