【发布时间】:2015-03-08 04:50:58
【问题描述】:
我需要跟踪踢球的速度。我编写了这段代码,但是当我运行程序时,即使我的右脚移动得非常快,速度也没有太大变化。
怎么了?
有不同的方法吗?
if (bandera == true)
{
X1 = skeleton.Joints[JointType.FootRight].Position.X;
Y1 = skeleton.Joints[JointType.FootRight].Position.Y;
Z1 = skeleton.Joints[JointType.FootRight].Position.Z;
}
if (bandera == false)
{
X2 = skeleton.Joints[JointType.FootRight].Position.X;
Y2 = skeleton.Joints[JointType.FootRight].Position.Y;
Z2 = skeleton.Joints[JointType.FootRight].Position.Z;
}
bandera = !bandera;
float d= (((X1 - X2) * (X1 - X2)) + ((Y1 - Y2) * (Y1 - Y2)) + ((Z1 - Z2 * (Z1 - Z2))));
double distance = System.Math.Sqrt(d);
double speed= 30 * distance;
Console.WriteLine(speed);
如你所知:速度=距离/时间 我知道每秒有 30 FPS,所以时间 = 1/30 所以速度等于距离除以 (1/30) 等于 30 * 距离
【问题讨论】:
标签: c# visual-studio kinect