Kinect关节角度计算

Kinect Joint Angle Calculation

对此感到抱歉,但我需要了解有关此函数和计算的一些信息

我目前有这些向量:

   Vector3D ElbowLeft = new Vector3D(body.Joints[JointType.ElbowLeft].Position.X, body.Joints[JointType.ElbowLeft].Position.Y, body.Joints[JointType.ElbowLeft].Position.Z);
   Vector3D WristLeft = new Vector3D(body.Joints[JointType.WristLeft].Position.X, body.Joints[JointType.WristLeft].Position.Y, body.Joints[JointType.WristLeft].Position.Z);
   Vector3D ShoulderLeft = new Vector3D(body.Joints[JointType.ShoulderLeft].Position.X, body.Joints[JointType.ShoulderLeft].Position.Y, body.Joints[JointType.ShoulderLeft].Position.Z);

   Vector3D Head = new Vector3D(body.Joints[JointType.Head].Position.X, body.Joints[JointType.Head].Position.Y, body.Joints[JointType.Head].Position.Z);
   Vector3D Neck = new Vector3D(body.Joints[JointType.Neck].Position.X, body.Joints[JointType.Neck].Position.Y, body.Joints[JointType.Neck].Position.Z);
   Vector3D SpineShoulder = new Vector3D(body.Joints[JointType.SpineShoulder].Position.X, body.Joints[JointType.SpineShoulder].Position.Y, body.Joints[JointType.SpineShoulder].Position.Z);

我正在使用这个函数计算两个向量之间的角度

public double AngleBetweenTwoVectors(Vector3D vectorA, Vector3D vectorB)
{
    double dotProduct = 0.0;
    vectorA.Normalize();
    vectorB.Normalize();
    dotProduct = Vector3D.DotProduct(vectorA, vectorB);

    return (double)Math.Acos(dotProduct) / Math.PI * 180;
}

我是这样称呼它的:

   double LeftElbowAngle = AngleBetweenTwoVectors(ElbowLeft - ShoulderLeft, ElbowLeft - WristLeft);
   double NeckAngle = AngleBetweenTwoVectors(Neck - Head, Neck - SpineBase);

这是正确的吗?我只是在怀疑自己,因为当我伸直手臂或站直时,它会检测到大约 170 - 175 度而不是 180 度的角度。在我的脖子和肘关节上

我已经确认上述算法在数学上是正确的,但是由于硬件的原因,设备的准确性可能有点偏差,并且个别人体骨骼可能会阻止 180 度的完美关节伸展。

纠正我如果我错了但我认为而不是这个 return(双)Math.Acos(点积)/Math.PI * 180 应该是

 return (double)Math.Acos(dotProduct) * (180.0/Math.PI);

因为 return 由 Math.Acos 计算的角度是弧度,要将其转换为度数,您应该将其乘以 180/pi