/* Displaying current frames hand joints */ private void DisplayJoints(HandData handOutput, long timeStamp = 0) { if (_form.GetJointsState() || _form.GetSkeletonState() || _form.GetExtremitiesState()) { //Iterate hands var nodes = new JointData[][] { new JointData[0x20], new JointData[0x20] }; var extremityNodes = new ExtremityData[][] { new ExtremityData[0x6], new ExtremityData[0x6] }; int numOfHands = handOutput.NumberOfHands; if (numOfHands == 1) { _mCursorPoints[1].Clear(); } for (int i = 0; i < 2; i++) { //Get hand by time of appearance IHand handData; if (handOutput.QueryHandData(AccessOrderType.ACCESS_ORDER_BY_TIME, i, out handData) == Status.STATUS_NO_ERROR) { if (handData != null) { var nodeIndex = handData.BodySide == BodySideType.BODY_SIDE_LEFT ? 0 : 1; //Iterate Joints foreach (var tJ in handData.TrackedJoints) { nodes[nodeIndex][(int)tJ.Key] = tJ.Value; } // end iterating over joints // iterate over extremity points if (_form.GetExtremitiesState()) { for (int j = 0; j < HandData.NUMBER_OF_EXTREMITIES; j++) { foreach (var eP in handData.ExtremityPoints) { extremityNodes[nodeIndex][(int)eP.Key] = eP.Value; } } } } } } // end iterating over hands _form.DisplayJoints(nodes, 2); if (numOfHands > 0) { if (_form.GetExtremitiesState()) { _form.DisplayExtremities(numOfHands, extremityNodes); } } } }
/* 显示当前帧手关节*/ private void DisplayJoints(HandData handOutput, long timeStamp = 0) { if (_form.GetJointsState() || _form.GetSkeletonState() || _form.GetExtremitiesState()) { //迭代手 var nodes = new JointData[][] { new JointData[0x20], new JointData[0x20] }; var extremityNodes = new ExtremityData[][] { new ExtremityData[0x6], new ExtremityData[0x6] }; int numOfHands = handOutput.NumberOfHands; if (numOfHands == 1) { _mCursorPoints[1].Clear(); } for (int i = 0; i < numOfHands; i++) { //在出现的时候检测手 IHand handData; if (handOutput.QueryHandData(AccessOrderType.ACCESS_ORDER_BY_TIME, i, out handData) == Status.STATUS_NO_ERROR) { if (handData != null) { //迭代手关节 foreach (var tJ in handData.TrackedJoints) { nodes[i][(int)tJ.Key] = tJ.Value; } // 手关节迭代结束 // 迭代手边缘点 if (_form.GetExtremitiesState()) { for (int j = 0; j < HandData.NUMBER_OF_EXTREMITIES; j++) { foreach (var eP in handData.ExtremityPoints) { extremityNodes[i][(int)eP.Key] = eP.Value; } } } } } } //迭代手结束 _form.DisplayJoints(nodes, numOfHands); if (numOfHands > 0) { if (_form.GetExtremitiesState()) { _form.DisplayExtremities(numOfHands, extremityNodes); } } } }