/* Displaying current frames hand joints */ private void DisplayJoints(PXCMHandData handOutput, long timeStamp = 0) { //Iterate hands PXCMHandData.JointData[][] nodes = new PXCMHandData.JointData[][] { new PXCMHandData.JointData[0x20], new PXCMHandData.JointData[0x20] }; int numOfHands = handOutput.QueryNumberOfHands(); for (int i = 0; i < numOfHands; i++) { //Get hand by time of appearence PXCMHandData.IHand handData; if (handOutput.QueryHandData(PXCMHandData.AccessOrderType.ACCESS_ORDER_BY_TIME, i, out handData) == pxcmStatus.PXCM_STATUS_NO_ERROR) { if (handData != null) { Coordinate coor; string handSide = "Unknown Hand"; handSide = handData.QueryBodySide() == PXCMHandData.BodySideType.BODY_SIDE_LEFT ? "Left Hand" : "Right Hand"; switch (handSide) { case ("Left Hand"): { coor.handside = 0; Rnum++; break; } case ("Right Hand"): { coor.handside = 1; Lnum++; break; } default: { coor.handside = 2; break; } } //Iterate Joints for (int j = 0; j < 0x20; j++) { sr = File.CreateText(FILE_NAME); PXCMHandData.JointData jointData; handData.QueryTrackedJoint((PXCMHandData.JointType)j, out jointData); nodes[i][j] = jointData; if (handData.QueryTrackedJoint((PXCMHandData.JointType)j, out jointData) == pxcmStatus.PXCM_STATUS_NO_ERROR && Handsinfo.JointToInt((PXCMHandData.JointType)j) != -1) { coor.finger = Handsinfo.JointToInt((PXCMHandData.JointType)j); coor.x = jointData.positionWorld.x; coor.y = jointData.positionWorld.y; coor.z = jointData.positionWorld.z; //right if (coor.finger == 1 && coor.handside == 1) { this.RHandMove(coor.x, coor.y); sr.WriteLine(coor.x + " " + coor.y + " " + coor.z + "\n"); MYPoint p = new MYPoint(coor.x, coor.y, coor.z); int num = rightcp.checkNote(p); if (num != 0 && Rnum < 2 && Lnum < 2) { DateTime DateTime2 = DateTime.Now; diff = tim.ExecTimeDiff(starttmp, DateTime2); this.HandClick(num, (int)diff); } } //left if (coor.finger == 1 && coor.handside == 0) { this.LHandMove(coor.x, coor.y); sr.WriteLine(coor.x + " " + coor.y + " " + coor.z + "\n"); MYPoint p = new MYPoint(coor.x, coor.y, coor.z); int num = leftcp.checkNote(p); if (num != 0 && Rnum < 2 && Lnum < 2) { DateTime DateTime2 = DateTime.Now; diff = tim.ExecTimeDiff(starttmp, DateTime2); this.HandClick(num, (int)diff); } } } sr.Close(); } // end iterating over joints } } // end itrating over hands } Lnum = 0; Rnum = 0; }
public checkPoint(MYPoint tp) { p = tp; press = false; ps = new List<MYPoint>(); oneNote = true; }
public virtual int checkNote(MYPoint pt) { p = pt; ps.Add(pt); isClick(); int num = isContain(); if (getPress() && oneNote && num != 0) { oneNote = false; return num; } checkPoint tcp = new checkPoint(); if (ps.Count() > 1) { tcp = new checkPoint(ps[ps.Count() - 2]); tcp.isClick(); if (!this.getPress() && tcp.getPress()) { oneNote = true; ps.Clear(); } } return 0; }
public checkDrum(MYPoint tp) { p = tp; press = false; }