internal Skeleton(SkeletonTrackingState trackingState, int trackingID, int enrollmentIndex, SkeletonPoint position, JointCollection joints) { TrackingState = trackingState; TrackingID = trackingID; EnrollmentIndex = enrollmentIndex; Position = position; Joints = joints; }
internal SkeletonFrame(long timeStamp, int frameNumber, SkeletonPoint floorClipPlane, Skeleton[] skeleton) { Timestamp = timeStamp; FrameNumber = frameNumber; FloorClipPlane = new Tuple<float, float, float, float>(floorClipPlane.X, floorClipPlane.Y, floorClipPlane.Z, floorClipPlane.W); Skeletons = skeleton; }
/// <summary> /// Determines whether two SkeletonPoint instances are equal. /// </summary> /// <param name="skeletonPoint1">A SkeletonPoint to compare for equality. </param> /// <param name="skeletonPoint2">A SkeletonPoint to compare for equality. </param> /// <returns>true if the two SkeletonPoint instances are equal; otherwise, false.</returns> public static bool op_Equality(SkeletonPoint skeletonPoint1, SkeletonPoint skeletonPoint2) { if (skeletonPoint1.X == skeletonPoint2.X && skeletonPoint1.Y == skeletonPoint2.Y && skeletonPoint1.Z == skeletonPoint2.Z) return true; return false; }
private static void CheckMoves(Skeleton skeleton) { var positions = skeleton.Joints.Select(j => j.Position).ToArray(); var newShoulderCenter = positions[(int)JointType.ShoulderCenter]; if (Math.Abs(newShoulderCenter.X - shoulderCenter.X) > 0.05) shoulderCenter = newShoulderCenter; hipCenter = positions[(int)JointType.HipCenter]; handRight = positions[(int)JointType.HandRight]; handLeft = positions[(int)JointType.HandLeft]; trackingID = skeleton.TrackingID; rightHandDifference = shoulderCenter.Z - handRight.Z; leftHandDifference = shoulderCenter.Z - handLeft.Z; // Convert the X and Y positions to a position on the screen. var leftX = Math.Round(ConvertX(handLeft.X + 0.45f), 0); var leftY = Math.Round(ConvertY(handLeft.Y), 0); var leftZ = handLeft.Z; if (leftX < 0) leftX = 0; if (leftY < 0) leftY = 0; leftArgs = new MoveEventArgs(trackingID, leftX, leftY, handLeft.Z); var rightX = Math.Round(ConvertX(handRight.X + 0.15f), 0); var rightY = Math.Round(ConvertY(handRight.Y), 0); var rightZ = handRight.Z; if (rightX < 0) rightX = 0; if (rightY < 0) rightY = 0; rightArgs = new MoveEventArgs(trackingID, rightX, rightY, handRight.Z); // Check all moves. CheckRightHandMove(); CheckLeftHandMove(); CheckScale(); CheckRotate(); CheckTranslate(); if (Transform != null) CheckTransform(); }
/// <summary> /// Determines whether two SkeletonPoint instances are not equal. /// </summary> /// <param name="skeletonPoint1">A SkeletonPoint to compare for inequality. </param> /// <param name="skeletonPoint2">A SkeletonPoint to compare for inequality. </param> /// <returns>true if the two SkeletonPoint instances are not equal; otherwise, false.</returns> public static bool op_Inequality(SkeletonPoint skeletonPoint1, SkeletonPoint skeletonPoint2) { if (skeletonPoint1.X != skeletonPoint2.X || skeletonPoint1.Y != skeletonPoint2.Y || skeletonPoint1.Z != skeletonPoint2.Z) return true; return false; }