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); } }
private void DrawFeedbackSkeleton(Body reference, Body record) { sampleGestureCanvas.Children.Clear(); SkeletonModel.Model.Joint centerReferenceJoint = reference.JointSkeleton.GetJoint(JointName.HipCenter); SkeletonModel.Model.Joint centerRecordJoint = record.JointSkeleton.GetJoint(JointName.HipCenter); DrawPoint(centerX, centerY, Colors.Yellow); DrawPoint(centerX, centerY, Colors.Red); foreach (JointName jointType in Enum.GetValues(typeof(JointName))) { SkeletonModel.Model.Joint joint = reference.JointSkeleton.GetJoint(jointType); if (joint == null) { continue; } double x = joint.XCoord - centerReferenceJoint.XCoord; double y = joint.YCoord - centerReferenceJoint.YCoord; DrawPoint(centerX + x * 200, centerY - y * 200, Colors.Yellow); } foreach (BoneName boneName in Enum.GetValues(typeof(BoneName))) { Tuple <JointName, JointName> boneExtremities = Mapper.BoneJointMap[boneName]; SkeletonModel.Model.Joint startJoint = reference.JointSkeleton.GetJoint(boneExtremities.Item1); SkeletonModel.Model.Joint endJoint = reference.JointSkeleton.GetJoint(boneExtremities.Item2); if (startJoint == null || endJoint == null) { continue; } double x1 = startJoint.XCoord - centerReferenceJoint.XCoord; double y1 = startJoint.YCoord - centerReferenceJoint.YCoord; double x2 = endJoint.XCoord - centerReferenceJoint.XCoord; double y2 = endJoint.YCoord - centerReferenceJoint.YCoord; DrawLine(centerX + x1 * 200, centerY - y1 * 200, centerX + x2 * 200, centerY - y2 * 200, Colors.OrangeRed); } foreach (JointName jointType in Enum.GetValues(typeof(JointName))) { SkeletonModel.Model.Joint joint = record.JointSkeleton.GetJoint(jointType); if (joint == null) { continue; } double x = joint.XCoord - centerRecordJoint.XCoord; double y = joint.YCoord - centerRecordJoint.YCoord; DrawPoint(centerX + x * 200, centerY - y * 200, Colors.Red); } foreach (BoneName boneName in Enum.GetValues(typeof(BoneName))) { Tuple <JointName, JointName> boneExtremities = Mapper.BoneJointMap[boneName]; SkeletonModel.Model.Joint startJoint = record.JointSkeleton.GetJoint(boneExtremities.Item1); SkeletonModel.Model.Joint endJoint = record.JointSkeleton.GetJoint(boneExtremities.Item2); if (startJoint == null || endJoint == null) { continue; } double x1 = startJoint.XCoord - centerRecordJoint.XCoord; double y1 = startJoint.YCoord - centerRecordJoint.YCoord; double x2 = endJoint.XCoord - centerRecordJoint.XCoord; double y2 = endJoint.YCoord - centerRecordJoint.YCoord; DrawLine(centerX + x1 * 200, centerY - y1 * 200, centerX + x2 * 200, centerY - y2 * 200, Colors.Black); } }