Пример #1
0
        public Bone(Skeleton skeleton, JointType name, Bone parent, double length, Vector3D direction)
        {
            this.skeleton = skeleton;
            this.name = name;
            this.parent = parent;
            this.length = length;
            tPoseDirection = direction;

            logger.Trace("Create {0}. Length: {1}", this, this.length);
        }
Пример #2
0
 public Bone(JointType from, JointType to)
 {
     From = from;
     To = to;
 }
Пример #3
0
        private void DrawBone(DrawingContext context, Pen pen, IDictionary<JointType, BodyFrameData.Joint> joints, JointType jointType1, JointType jointType2)
        {
            var joint1 = joints[jointType1];
            var joint2 = joints[jointType2];

            // If we can't find either of these joints, exit
            if (joint1.State == TrackingState.NotTracked ||
                joint2.State == TrackingState.NotTracked)
            {
                return;
            }

            // We assume all drawn bones are inferred unless BOTH joints are tracked
            if ((joint1.State != TrackingState.Tracked) || (joint2.State != TrackingState.Tracked))
            {
                pen = inferredBonePen;
            }

            context.DrawLine(pen, joints[jointType1].Position2D, joints[jointType2].Position2D);
        }
Пример #4
0
        private Bone CreateBone(JointType name, Bone parent, double length, Vector3D tPoseDirection)
        {
            var bone = new Bone(this, name, parent, length, tPoseDirection);

            bones.Add(bone);

            return bone;
        }
Пример #5
0
        private static double GetBoneLength(BodyFrameData.Body body, JointType from1, JointType to1, JointType from2, JointType to2)
        {
            var length1 = GetBoneLength(body, from1, to1);
            var length2 = GetBoneLength(body, from2, to2);

            return (length1 + length2) / 2;
        }
Пример #6
0
        private static double GetBoneLength(BodyFrameData.Body body, JointType from, JointType to)
        {
            var fromPos = body.Joints[from].Position3D;
            var toPos = body.Joints[to].Position3D;

            return (fromPos - toPos).Length;
        }