private void DrawSampleGestureJoints(JointSkeleton jointSkeleton) { sampleGestureCanvas.Children.Clear(); DrawPoint(centerX, centerY, Colors.Yellow); SkeletonModel.Model.Joint centerJoint = jointSkeleton.GetJoint(JointName.HipCenter); foreach (JointName jointType in Enum.GetValues(typeof(JointName))) { SkeletonModel.Model.Joint joint = jointSkeleton.GetJoint(jointType); if (joint == null) { continue; } double x = joint.XCoord - centerJoint.XCoord; double y = joint.YCoord - centerJoint.YCoord; DrawPoint(centerX + x * 150, centerY - y * 150, Colors.Yellow); // have a mirror display } }
private void DrawSampleGestureBones(JointSkeleton jointSkeleton) { SkeletonModel.Model.Joint centerJoint = jointSkeleton.GetJoint(JointName.HipCenter); foreach (BoneName boneName in Enum.GetValues(typeof(BoneName))) { Tuple <JointName, JointName> boneExtremities = Mapper.BoneJointMap[boneName]; SkeletonModel.Model.Joint startJoint = jointSkeleton.GetJoint(boneExtremities.Item1); SkeletonModel.Model.Joint endJoint = jointSkeleton.GetJoint(boneExtremities.Item2); if (startJoint == null || endJoint == null) { continue; } double x1 = startJoint.XCoord - centerJoint.XCoord; double y1 = startJoint.YCoord - centerJoint.YCoord; double x2 = endJoint.XCoord - centerJoint.XCoord; double y2 = endJoint.YCoord - centerJoint.YCoord; DrawLine(centerX + x1 * 150, centerY - y1 * 150, centerX + x2 * 150, centerY - y2 * 150, Colors.OrangeRed); } }