private Vertex3 GetJointPosition(Microsoft.Kinect.Skeleton skeleton, JointType jointType) { Microsoft.Kinect.JointType kinectJointType = JointUtilities.TranslateJointType(jointType); Microsoft.Kinect.SkeletonPoint kinectPoint = skeleton.Joints[kinectJointType].Position; Vertex3 position = GetPosition(kinectPoint); return(position); }
private void TrackSkeletonJoints(Microsoft.Kinect.Skeleton skeleton, DateTime timeStamp) { // Tracks the MovingJoints in the specified skeleton. foreach (JointType jointType in JointUtilities.MovingJoints) { // RBakerFlag -> Needs to be refactored. Need to fire event. JointType[] connectedJoints = JointUtilities.GetConnectedJoints(jointType); if (!ShouldTrackJoint(skeleton, jointType, connectedJoints)) { continue; } Vertex3 jointPosition = GetJointPosition(skeleton, jointType); Vertex3[] connectedJointPositions = GetJointPositions(skeleton, connectedJoints); Vector3 boneA = new Vector3(connectedJointPositions[0], jointPosition); Vector3 boneB = new Vector3(connectedJointPositions[1], jointPosition); double bendAngle = Vector3Functions.Angle(boneA, boneB); MovingJoint movingJoint = new MovingJoint(jointType, jointPosition, bendAngle); OnJointTrackingCaptured(movingJoint, timeStamp); } }
private Microsoft.Kinect.JointTrackingState JointTrackingState(Microsoft.Kinect.Skeleton skeleton, JointType jointType) { Microsoft.Kinect.JointType kinectJointType = JointUtilities.TranslateJointType(jointType); return(skeleton.Joints[kinectJointType].TrackingState); }