// Gesture 10 private bool ArmsSidePosition_R(Body body) { FloatBody floatBody; bool detected = false; floatBody = new FloatBody(); floatBody.shoulderRight.coo_y = body.Joints[JointType.ShoulderRight].Position.Y; floatBody.spineShoulder.coo_y = body.Joints[JointType.SpineShoulder].Position.Y; floatBody.spineShoulder.coo_z = body.Joints[JointType.SpineShoulder].Position.Z; floatBody.elbowRight.coo_y = body.Joints[JointType.ElbowRight].Position.Y; floatBody.wristRight.coo_x = body.Joints[JointType.WristRight].Position.X; floatBody.wristRight.coo_y = body.Joints[JointType.WristRight].Position.Y; floatBody.wristRight.coo_z = body.Joints[JointType.WristRight].Position.Z; if (floatBody.wristRight.coo_z <= floatBody.spineShoulder.coo_z + 0.2 && floatBody.wristRight.coo_z >= floatBody.spineShoulder.coo_z - 0.2) { if (floatBody.elbowRight.coo_y <= floatBody.shoulderRight.coo_y + 0.1 && floatBody.elbowRight.coo_y >= floatBody.shoulderRight.coo_y - 0.1) { if (floatBody.wristRight.coo_y <= floatBody.spineShoulder.coo_y + 0.1 && floatBody.wristRight.coo_y >= floatBody.spineShoulder.coo_y - 0.1) { if (floatBody.wristRight.coo_y + 0.25 > 0 || floatBody.wristRight.coo_y - 0.25 < 0) { detected = true; } } } } return(detected); }
// Gesture 2 private bool Arms45UpPosition(Body body) { FloatBody floatBody; bool detected = false; floatBody = new FloatBody(); floatBody.head.coo_y = body.Joints[JointType.Head].Position.Y; floatBody.shoulderLeft.coo_x = body.Joints[JointType.ShoulderLeft].Position.X; floatBody.shoulderRight.coo_x = body.Joints[JointType.ShoulderRight].Position.X; floatBody.elbowRight.coo_z = body.Joints[JointType.ElbowRight].Position.Z; floatBody.elbowLeft.coo_z = body.Joints[JointType.ElbowLeft].Position.Z; floatBody.wristLeft.coo_x = body.Joints[JointType.WristLeft].Position.X; floatBody.wristLeft.coo_y = body.Joints[JointType.WristLeft].Position.Y; floatBody.wristLeft.coo_z = body.Joints[JointType.WristLeft].Position.Z; floatBody.wristRight.coo_x = body.Joints[JointType.WristRight].Position.X; floatBody.wristRight.coo_y = body.Joints[JointType.WristRight].Position.Y; floatBody.wristRight.coo_z = body.Joints[JointType.WristRight].Position.Z; if (floatBody.wristLeft.coo_z < floatBody.elbowLeft.coo_z && floatBody.wristRight.coo_z < floatBody.elbowRight.coo_z) { if (floatBody.wristLeft.coo_x <= floatBody.shoulderLeft.coo_x) { if (floatBody.wristRight.coo_x >= floatBody.shoulderRight.coo_x) { if (floatBody.wristRight.coo_y >= floatBody.head.coo_y && floatBody.wristLeft.coo_y >= floatBody.head.coo_y) { detected = true; } } } } return(detected); }
// Gesture 1 private bool Arms45DownPosition(Body body) { FloatBody floatBody; bool detected = false; floatBody = new FloatBody(); floatBody.spineMid.coo_y = body.Joints[JointType.SpineMid].Position.Y; floatBody.spineBase.coo_y = body.Joints[JointType.SpineBase].Position.Y; floatBody.shoulderLeft.coo_x = body.Joints[JointType.ShoulderLeft].Position.X; floatBody.shoulderRight.coo_x = body.Joints[JointType.ShoulderRight].Position.X; floatBody.elbowRight.coo_z = body.Joints[JointType.ElbowRight].Position.Z; floatBody.elbowLeft.coo_z = body.Joints[JointType.ElbowLeft].Position.Z; floatBody.handTipLeft.coo_x = body.Joints[JointType.HandTipLeft].Position.X; floatBody.handTipLeft.coo_y = body.Joints[JointType.HandTipLeft].Position.Y; floatBody.handTipLeft.coo_z = body.Joints[JointType.HandTipLeft].Position.Z; floatBody.handTipRight.coo_x = body.Joints[JointType.HandTipRight].Position.X; floatBody.handTipRight.coo_y = body.Joints[JointType.HandTipRight].Position.Y; floatBody.handTipRight.coo_z = body.Joints[JointType.HandTipRight].Position.Z; if (floatBody.handTipLeft.coo_z < floatBody.elbowLeft.coo_z && floatBody.handTipRight.coo_z < floatBody.elbowRight.coo_z) { if (floatBody.handTipLeft.coo_x <= floatBody.shoulderLeft.coo_x) { if (floatBody.handTipRight.coo_x >= floatBody.shoulderRight.coo_x) { if (floatBody.handTipRight.coo_y <= floatBody.spineMid.coo_y && floatBody.handTipLeft.coo_y <= floatBody.spineMid.coo_y) { if (floatBody.handTipRight.coo_y >= floatBody.spineBase.coo_y && floatBody.handTipLeft.coo_y >= floatBody.spineBase.coo_y) { detected = true; } } } } } return(detected); }
// Gesture 5 private bool ArmsHRectanglePosition_L(Body body) { FloatBody floatBody; bool detected = false; floatBody = new FloatBody(); floatBody.head.coo_y = body.Joints[JointType.Head].Position.Y; floatBody.shoulderLeft.coo_y = body.Joints[JointType.ShoulderLeft].Position.Y; floatBody.spineShoulder.coo_y = body.Joints[JointType.SpineShoulder].Position.Y; floatBody.spineShoulder.coo_z = body.Joints[JointType.SpineShoulder].Position.Z; floatBody.elbowLeft.coo_x = body.Joints[JointType.ElbowLeft].Position.X; floatBody.elbowLeft.coo_y = body.Joints[JointType.ElbowLeft].Position.Y; floatBody.elbowLeft.coo_z = body.Joints[JointType.ElbowLeft].Position.Z; floatBody.wristLeft.coo_x = body.Joints[JointType.WristLeft].Position.X; floatBody.wristLeft.coo_y = body.Joints[JointType.WristLeft].Position.Y; if (floatBody.elbowLeft.coo_z <= floatBody.spineShoulder.coo_z + 0.5 && floatBody.elbowLeft.coo_z >= floatBody.spineShoulder.coo_z - 0.5) { if (floatBody.wristLeft.coo_y >= floatBody.head.coo_y) { if (floatBody.shoulderLeft.coo_y <= floatBody.spineShoulder.coo_y + 0.1 && floatBody.shoulderLeft.coo_y >= floatBody.spineShoulder.coo_y - 0.1) { if (floatBody.wristLeft.coo_x <= floatBody.shoulderRight.coo_x - 0.2) { if (floatBody.elbowLeft.coo_y <= floatBody.shoulderLeft.coo_y + 0.1 && floatBody.elbowLeft.coo_y >= floatBody.shoulderLeft.coo_y - 0.1) { if (floatBody.wristLeft.coo_x <= floatBody.elbowLeft.coo_x + 0.1 && floatBody.wristLeft.coo_x >= floatBody.elbowLeft.coo_x - 0.1) { detected = true; } } } } } } return(detected); }
// Gesture 3 private bool ArmsFrontPosition_L(Body body) { FloatBody floatBody; bool detected = false; floatBody = new FloatBody(); floatBody.neck.coo_y = body.Joints[JointType.Neck].Position.Y; floatBody.spineMid.coo_y = body.Joints[JointType.SpineMid].Position.Y; floatBody.elbowLeft.coo_x = body.Joints[JointType.ElbowLeft].Position.X; floatBody.shoulderLeft.coo_x = body.Joints[JointType.ShoulderLeft].Position.X; floatBody.shoulderLeft.coo_y = body.Joints[JointType.ShoulderLeft].Position.Y; floatBody.spineShoulder.coo_z = body.Joints[JointType.SpineShoulder].Position.Z; floatBody.wristLeft.coo_x = body.Joints[JointType.WristLeft].Position.X; floatBody.wristLeft.coo_y = body.Joints[JointType.WristLeft].Position.Y; floatBody.wristLeft.coo_z = body.Joints[JointType.WristLeft].Position.Z; if (floatBody.wristLeft.coo_z < floatBody.spineShoulder.coo_z && floatBody.spineShoulder.coo_z - 0.4 > floatBody.wristLeft.coo_z) { if (floatBody.wristLeft.coo_y < floatBody.neck.coo_y) { if (floatBody.wristLeft.coo_x >= floatBody.shoulderLeft.coo_x - 0.25 && floatBody.wristLeft.coo_y <= floatBody.shoulderLeft.coo_y) { if (floatBody.wristLeft.coo_x < floatBody.elbowLeft.coo_x) { if (floatBody.wristLeft.coo_y >= floatBody.shoulderLeft.coo_y - 0.5) { if (floatBody.wristLeft.coo_y >= floatBody.spineMid.coo_y) { detected = true; } } } } } } return(detected); }