// get one joint's offset in kinect skeleton frame
        private Point3D getNodeOffset(JointNode node, Skeleton skeleton)
        {
            if (!node.IsKinectJoint)
            {
                return(new Point3D());
            }

            Point3D offset;

            if (node.Type == NodeTypeEnum.ROOT)
            {
                offset = new Point3D(skeleton.Position.X, skeleton.Position.Y, skeleton.Position.Z);
            }
            else
            {
                JointNode parent = node.Parent;
                while (null != parent && !parent.IsKinectJoint)
                {
                    parent = parent.Parent;
                }
                offset = new Point3D(skeleton.Joints[node.JointIndex].Position.X - skeleton.Joints[parent.JointIndex].Position.X,
                                     skeleton.Joints[node.JointIndex].Position.Y - skeleton.Joints[parent.JointIndex].Position.Y,
                                     skeleton.Joints[node.JointIndex].Position.Z - skeleton.Joints[parent.JointIndex].Position.Z);
            }
            BVHFile.BVHScalePoint(ref offset);
            return(offset);
        }
        private void updateDebugBone(JointNode node)
        {
            if (node.Type == NodeTypeEnum.ROOT)
            {
                node.Rotation  = new Vector3D(0, 0, 180);
                node.Offset.X += node.OriginalOffset.X + canvas.Width / 2;
                node.Offset.Y += node.OriginalOffset.Y + canvas.Height / 2;
                node.Offset.Z += node.OriginalOffset.Z;
            }
            else
            {
                Quaternion parentRotation = MathHelper.ConvertToQuaternion(node.Parent.Rotation);
                MathHelper.RotatePoint(node.OriginalOffset, parentRotation, out node.Offset);
                node.Offset.X += node.Parent.Offset.X;
                node.Offset.Y += node.Parent.Offset.Y;
                node.Offset.Z += node.Parent.Offset.Z;
                node.Rotation  = MathHelper.QuaternionToAxisAngles(parentRotation * MathHelper.ConvertToQuaternion(node.Rotation));
            }

            if (node.Type == NodeTypeEnum.END)
            {
                return;
            }
            foreach (JointNode child in node.Children)
            {
                updateDebugBone(child);
            }
        }
示例#3
0
 /// <summary>
 /// output a given joint in BVH format
 /// </summary>
 /// <param name="joint"></param>
 /// <param name="sbOut"></param>
 /// <param name="indents"></param>
 private void buildBVHOutputSkeleton(JointNode root, string indents = "")
 {
     _bvhSkeletonBuffer.Append(indents);
     _bvhSkeletonBuffer.Append(root.Type != NodeTypeEnum.END ?
                               root.Type.ToString() + CHAR_SPACE + root.Name : STR_END_SITE).Append(CHAR_LF);
     _bvhSkeletonBuffer.Append(indents).Append(CHAR_OPEN_BRACE).Append(CHAR_LF);
     _bvhSkeletonBuffer.Append(indents).Append(CHAR_SPACE).Append(CHAR_SPACE).Append(STR_OFFSET).Append(CHAR_SPACE)
     .Append(root.OriginalOffset.X.ToString()).Append(CHAR_SPACE)
     .Append(root.OriginalOffset.Y.ToString()).Append(CHAR_SPACE)
     .Append(root.OriginalOffset.Z.ToString()).Append(CHAR_LF);
     if (root.Type != NodeTypeEnum.END)
     {
         _bvhSkeletonBuffer.Append(indents).Append(CHAR_SPACE).Append(CHAR_SPACE).Append(STR_CHANNELS).Append(CHAR_SPACE)
         .Append(root.Type == NodeTypeEnum.ROOT ? ROOT_CHANNEL_NUM : JOINT_CHANNEL_NUM);
         if (root.Type == NodeTypeEnum.ROOT)
         {
             _bvhSkeletonBuffer.Append(CHAR_SPACE).Append(STR_XPOSITION)
             .Append(CHAR_SPACE).Append(STR_YPOSITION)
             .Append(CHAR_SPACE).Append(STR_ZPOSITION);
         }
         _bvhSkeletonBuffer.Append(CHAR_SPACE).Append(STR_ZROTATION)
         .Append(CHAR_SPACE).Append(STR_XROTATION)
         .Append(CHAR_SPACE).Append(STR_YROTATION).Append(CHAR_LF);
         foreach (JointNode childJoint in root.Children)
         {
             buildBVHOutputSkeleton(childJoint, indents + CHAR_SPACE + CHAR_SPACE);
         }
     }
     _bvhSkeletonBuffer.Append(indents).Append(CHAR_CLOSE_BRACE).Append(CHAR_LF);
 }
        /// <summary>
        /// one joint's rotation is actually stored in its parent joint, so for a given joint, we should get its child joint's rotation
        /// </summary>
        /// <param name="joint"></param>
        /// <returns></returns>
        private JointType getRotationJoint(JointNode node)
        {
            switch (node.Name)
            {
            case "ShoulderLeft":
                return(JointType.ElbowLeft);

            case "ElbowLeft":
                return(JointType.WristLeft);

            case "WristLeft":
                return(JointType.HandLeft);

            case "ShoulderRight":
                return(JointType.ElbowRight);

            case "ElbowRight":
                return(JointType.WristRight);

            case "WristRight":
                return(JointType.HandRight);

            case "HipLeft":
                return(JointType.KneeLeft);

            case "KneeLeft":
                return(JointType.AnkleLeft);

            case "AnkleLeft":
                return(JointType.FootLeft);

            case "HipRight":
                return(JointType.KneeRight);

            case "KneeRight":
                return(JointType.AnkleRight);

            case "AnkleRight":
                return(JointType.FootRight);

            default:
                //case "HipCenter":
                //case "HipCenter2":
                //case "Spine":
                //case "ShoulderCenter":
                //case "Neck":
                //case "Head":
                //case "CollarLeft":
                //case "CollarRight":
                return(node.JointIndex);
            }
        }
        /// <summary>
        /// get a bone's original offset based on its own offset and the symmetric node's offset if it has
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        private double getJointStandardInitialOffset(JointNode node)
        {
            double offsetLength = getMaxAxisFromPoint(_initialOffsets[node.Name]);

            if (getSymmetricNode(node) == node)
            {
                return(offsetLength);
            }
            else
            {
                double symmetricNodeOffsetLength = getMaxAxisFromPoint(_initialOffsets[getSymmetricNode(node).Name]);
                return((offsetLength + symmetricNodeOffsetLength) / 2);
            }
        }
        /// <summary>
        /// length of hip center - spine - shoulder center - head
        /// </summary>
        /// <param name="skeleton"></param>
        /// <param name="bone"></param>
        /// <param name="startJoint"></param>
        /// <param name="endJoint"></param>
        private void calCenterBoneLength(Skeleton skeleton, JointNode node)
        {
            double length = BVHFile.BVHScaledValue(calDescartesLength(skeleton.Joints[node.Parent.JointIndex].Position,
                                                                      skeleton.Joints[node.JointIndex].Position));

            if (_boneLengths.ContainsKey(node.JointIndex))
            {
                _boneLengths[node.JointIndex] = (length + _boneLengths[node.JointIndex]) / 2;
            }
            else
            {
                _boneLengths.Add(node.JointIndex, length);
            }
        }
 private JointNode getSymmetricNode(JointNode node)
 {
     if (node.Name.Contains("Left"))
     {
         return(JointNodes[node.Name.Replace("Left", "Right")]);
     }
     else if (node.Name.Contains("Right"))
     {
         return(JointNodes[node.Name.Replace("Right", "Left")]);
     }
     else
     {
         return(node);
     }
 }
示例#8
0
 public JointNode(string name, JointType index, JointNode parent, Axis axis, NodeTypeEnum type, bool isKinectJoint)
 {
     this.IsKinectJoint = isKinectJoint;
     this.JointIndex = index;
     Name = isKinectJoint ? index.ToString() : name;
     this.BaseAxis = axis;
     this.Type = type;
     if(Type != NodeTypeEnum.END)
         Children = new ArrayList();
     if (null != parent)
     {
         this.Parent = parent;
         parent.AddChild(this);
     }
 }
        /// <summary>
        /// length of shoulder center - shoulder - elbow - wrist - hand, hip center - hip - knee - ankle - foot
        /// </summary>
        /// <param name="skeleton"></param>
        /// <param name="bone"></param>
        /// <param name="startJoint"></param>
        /// <param name="endJoint"></param>
        private void calSideBoneLength(Skeleton skeleton, JointNode node)
        {
            double leftLength = BVHFile.BVHScaledValue(calDescartesLength(skeleton.Joints[node.Parent.JointIndex].Position,
                                                                          skeleton.Joints[node.JointIndex].Position));
            double rightLength = BVHFile.BVHScaledValue(calDescartesLength(skeleton.Joints[GetSymmetricJoint(node.Parent.JointIndex)].Position,
                                                                           skeleton.Joints[GetSymmetricJoint(node.JointIndex)].Position));
            double length = (leftLength + rightLength) / 2;

            if (_boneLengths.ContainsKey(node.JointIndex))
            {
                _boneLengths[node.JointIndex] = (length + _boneLengths[node.JointIndex]) / 2;
            }
            else
            {
                _boneLengths.Add(node.JointIndex, length);
            }
        }
示例#10
0
 public JointNode(string name, JointType index, JointNode parent, Axis axis, NodeTypeEnum type, bool isKinectJoint)
 {
     this.IsKinectJoint = isKinectJoint;
     this.JointIndex    = index;
     Name          = isKinectJoint ? index.ToString() : name;
     this.BaseAxis = axis;
     this.Type     = type;
     if (Type != NodeTypeEnum.END)
     {
         Children = new ArrayList();
     }
     if (null != parent)
     {
         this.Parent = parent;
         parent.AddChild(this);
     }
 }
示例#11
0
        private void updateDebugBone(JointNode node)
        {
            if (node.Type == NodeTypeEnum.ROOT)
            {
                node.Rotation = new Vector3D(0, 0, 180);
                node.Offset.X += node.OriginalOffset.X + canvas.Width / 2;
                node.Offset.Y += node.OriginalOffset.Y + canvas.Height / 2;
                node.Offset.Z += node.OriginalOffset.Z;
            }
            else
            {
                Quaternion parentRotation = MathHelper.ConvertToQuaternion(node.Parent.Rotation);
                MathHelper.RotatePoint(node.OriginalOffset, parentRotation, out node.Offset);
                node.Offset.X += node.Parent.Offset.X;
                node.Offset.Y += node.Parent.Offset.Y;
                node.Offset.Z += node.Parent.Offset.Z;
                node.Rotation = MathHelper.QuaternionToAxisAngles(parentRotation * MathHelper.ConvertToQuaternion(node.Rotation));
            }

            if (node.Type == NodeTypeEnum.END)
                return;
            foreach (JointNode child in node.Children)
            {
                updateDebugBone(child);
            }
        }
示例#12
0
 public bool AddChild(JointNode node)
 {
     return Children.Add(node) >= 0;
 }
示例#13
0
 private void AddBVHBone_Debug(JointNode node1, JointNode node2)
 {
     addLineToWindow(node1.Offset.X, node1.Offset.Y,
         node2.Offset.X, node2.Offset.Y,
         BTUSH_BONE_DEBUG, DOUBLE_THICKNESS_BONE_DEBUG);
 }
示例#14
0
        /// <summary>
        /// initialize human skeleton structure
        /// </summary>
        private void initializeSkeletonStructure()
        {
            JointNodes = new Dictionary <string, JointNode>();

            // root
            HipCenter = new JointNode(JointType.HipCenter.ToString(), JointType.HipCenter, null, Axis.None, NodeTypeEnum.ROOT, true);
            JointNodes.Add(HipCenter.Name, HipCenter);

            // hip, spine, shouderCenter, neck, head
            JointNode hipCenter2 = new JointNode("HipCenter2", JointType.HipCenter, HipCenter, Axis.Y, NodeTypeEnum.JOINT, false);

            JointNodes.Add(hipCenter2.Name, hipCenter2);
            JointNode spine = new JointNode(JointType.Spine, hipCenter2, Axis.Y);

            JointNodes.Add(spine.Name, spine);
            JointNode shoulderCenter = new JointNode(JointType.ShoulderCenter, spine, Axis.Y);

            JointNodes.Add(shoulderCenter.Name, shoulderCenter);
            JointNode neck = new JointNode("Neck", JointType.Head, shoulderCenter, Axis.Y, NodeTypeEnum.JOINT, false);

            JointNodes.Add(neck.Name, neck);
            JointNode head = new JointNode(JointType.Head, neck, Axis.Y);

            JointNodes.Add(head.Name, head);
            JointNode headEnd = new JointNode("HeadEnd", JointType.Head, head, Axis.None, NodeTypeEnum.END, false);

            JointNodes.Add(headEnd.Name, headEnd);

            // left arm
            JointNode collarLeft = new JointNode("CollarLeft", JointType.ShoulderLeft, shoulderCenter, Axis.X, NodeTypeEnum.JOINT, false);

            JointNodes.Add(collarLeft.Name, collarLeft);
            JointNode shoulderLeft = new JointNode(JointType.ShoulderLeft, collarLeft, Axis.X);

            JointNodes.Add(shoulderLeft.Name, shoulderLeft);
            JointNode elbowLeft = new JointNode(JointType.ElbowLeft, shoulderLeft, Axis.X);

            JointNodes.Add(elbowLeft.Name, elbowLeft);
            JointNode wristLeft = new JointNode(JointType.WristLeft, elbowLeft, Axis.X);

            JointNodes.Add(wristLeft.Name, wristLeft);
            JointNode handLeft = new JointNode(JointType.HandLeft.ToString(), JointType.HandLeft, wristLeft, Axis.X, NodeTypeEnum.END, true);

            JointNodes.Add(handLeft.Name, handLeft);

            // right arm
            JointNode collarRight = new JointNode("CollarRight", JointType.ShoulderRight, shoulderCenter, Axis.nX, NodeTypeEnum.JOINT, false);

            JointNodes.Add(collarRight.Name, collarRight);
            JointNode shoulderRight = new JointNode(JointType.ShoulderRight, collarRight, Axis.nX);

            JointNodes.Add(shoulderRight.Name, shoulderRight);
            JointNode elbowRight = new JointNode(JointType.ElbowRight, shoulderRight, Axis.nX);

            JointNodes.Add(elbowRight.Name, elbowRight);
            JointNode wristRight = new JointNode(JointType.WristRight, elbowRight, Axis.nX);

            JointNodes.Add(wristRight.Name, wristRight);
            JointNode handRight = new JointNode(JointType.HandRight.ToString(), JointType.HandRight, wristRight, Axis.nX, NodeTypeEnum.END, true);

            JointNodes.Add(handRight.Name, handRight);

            // left lower part
            JointNode hipLeft = new JointNode(JointType.HipLeft, HipCenter, Axis.X);

            JointNodes.Add(hipLeft.Name, hipLeft);
            JointNode KneeLeft = new JointNode(JointType.KneeLeft, hipLeft, Axis.nY);

            JointNodes.Add(KneeLeft.Name, KneeLeft);
            JointNode ankleLeft = new JointNode(JointType.AnkleLeft, KneeLeft, Axis.nY);

            JointNodes.Add(ankleLeft.Name, ankleLeft);
            JointNode footLeft = new JointNode(JointType.FootLeft.ToString(), JointType.FootLeft, ankleLeft, Axis.Z, NodeTypeEnum.END, true);

            JointNodes.Add(footLeft.Name, footLeft);

            // right lower part
            JointNode hipRight = new JointNode(JointType.HipRight, HipCenter, Axis.nX);

            JointNodes.Add(hipRight.Name, hipRight);
            JointNode kneeRight = new JointNode(JointType.KneeRight, hipRight, Axis.nY);

            JointNodes.Add(kneeRight.Name, kneeRight);
            JointNode ankleRight = new JointNode(JointType.AnkleRight, kneeRight, Axis.nY);

            JointNodes.Add(ankleRight.Name, ankleRight);
            JointNode footRight = new JointNode(JointType.FootRight.ToString(), JointType.FootRight, ankleRight, Axis.Z, NodeTypeEnum.END, true);

            JointNodes.Add(footRight.Name, footRight);
        }
示例#15
0
 private JointNode getSymmetricNode(JointNode node)
 {
     if (node.Name.Contains("Left"))
     {
         return JointNodes[node.Name.Replace("Left", "Right")];
     }
     else if (node.Name.Contains("Right"))
     {
         return JointNodes[node.Name.Replace("Right", "Left")];
     }
     else
     {
         return node;
     }
 }
示例#16
0
        // get one joint's offset in kinect skeleton frame
        private Point3D getNodeOffset(JointNode node, Skeleton skeleton)
        {
            if (!node.IsKinectJoint)
                return new Point3D();

            Point3D offset;
            if (node.Type == NodeTypeEnum.ROOT)
                offset = new Point3D(skeleton.Position.X, skeleton.Position.Y, skeleton.Position.Z);
            else
            {
                JointNode parent = node.Parent;
                while (null != parent && !parent.IsKinectJoint)
                    parent = parent.Parent;
                offset = new Point3D(skeleton.Joints[node.JointIndex].Position.X - skeleton.Joints[parent.JointIndex].Position.X,
                    skeleton.Joints[node.JointIndex].Position.Y - skeleton.Joints[parent.JointIndex].Position.Y,
                    skeleton.Joints[node.JointIndex].Position.Z - skeleton.Joints[parent.JointIndex].Position.Z);
            }
            BVHFile.BVHScalePoint(ref offset);
            return offset;
        }
示例#17
0
 /// <summary>
 /// length of shoulder center - shoulder - elbow - wrist - hand, hip center - hip - knee - ankle - foot
 /// </summary>
 /// <param name="skeleton"></param>
 /// <param name="bone"></param>
 /// <param name="startJoint"></param>
 /// <param name="endJoint"></param>
 private void calSideBoneLength(Skeleton skeleton, JointNode node)
 {
     double leftLength = BVHFile.BVHScaledValue(calDescartesLength(skeleton.Joints[node.Parent.JointIndex].Position,
         skeleton.Joints[node.JointIndex].Position));
     double rightLength = BVHFile.BVHScaledValue(calDescartesLength(skeleton.Joints[GetSymmetricJoint(node.Parent.JointIndex)].Position,
         skeleton.Joints[GetSymmetricJoint(node.JointIndex)].Position));
     double length = (leftLength + rightLength) / 2;
     if (_boneLengths.ContainsKey(node.JointIndex))
     {
         _boneLengths[node.JointIndex] = (length + _boneLengths[node.JointIndex]) / 2;
     }
     else
     {
         _boneLengths.Add(node.JointIndex, length);
     }
 }
示例#18
0
 /// <summary>
 /// output a given joint in BVH format
 /// </summary>
 /// <param name="joint"></param>
 /// <param name="sbOut"></param>
 /// <param name="indents"></param>
 private void buildBVHOutputSkeleton(JointNode root, string indents = "")
 {
     _bvhSkeletonBuffer.Append(indents);
     _bvhSkeletonBuffer.Append(root.Type != NodeTypeEnum.END ?
         root.Type.ToString() + CHAR_SPACE + root.Name : STR_END_SITE).Append(CHAR_LF);
     _bvhSkeletonBuffer.Append(indents).Append(CHAR_OPEN_BRACE).Append(CHAR_LF);
     _bvhSkeletonBuffer.Append(indents).Append(CHAR_SPACE).Append(CHAR_SPACE).Append(STR_OFFSET).Append(CHAR_SPACE)
         .Append(root.OriginalOffset.X.ToString()).Append(CHAR_SPACE)
         .Append(root.OriginalOffset.Y.ToString()).Append(CHAR_SPACE)
         .Append(root.OriginalOffset.Z.ToString()).Append(CHAR_LF);
     if (root.Type != NodeTypeEnum.END)
     {
         _bvhSkeletonBuffer.Append(indents).Append(CHAR_SPACE).Append(CHAR_SPACE).Append(STR_CHANNELS).Append(CHAR_SPACE)
             .Append(root.Type == NodeTypeEnum.ROOT ? ROOT_CHANNEL_NUM : JOINT_CHANNEL_NUM);
         if (root.Type == NodeTypeEnum.ROOT)
         {
             _bvhSkeletonBuffer.Append(CHAR_SPACE).Append(STR_XPOSITION)
                 .Append(CHAR_SPACE).Append(STR_YPOSITION)
                 .Append(CHAR_SPACE).Append(STR_ZPOSITION);
         }
         _bvhSkeletonBuffer.Append(CHAR_SPACE).Append(STR_ZROTATION)
         .Append(CHAR_SPACE).Append(STR_XROTATION)
         .Append(CHAR_SPACE).Append(STR_YROTATION).Append(CHAR_LF);
         foreach (JointNode childJoint in root.Children)
         {
             buildBVHOutputSkeleton(childJoint, indents + CHAR_SPACE + CHAR_SPACE);
         }
     }
     _bvhSkeletonBuffer.Append(indents).Append(CHAR_CLOSE_BRACE).Append(CHAR_LF);
 }
示例#19
0
 /// <summary>
 /// length of hip center - spine - shoulder center - head
 /// </summary>
 /// <param name="skeleton"></param>
 /// <param name="bone"></param>
 /// <param name="startJoint"></param>
 /// <param name="endJoint"></param>
 private void calCenterBoneLength(Skeleton skeleton, JointNode node)
 {
     double length = BVHFile.BVHScaledValue(calDescartesLength(skeleton.Joints[node.Parent.JointIndex].Position,
         skeleton.Joints[node.JointIndex].Position));
     if (_boneLengths.ContainsKey(node.JointIndex))
     {
         _boneLengths[node.JointIndex] = (length + _boneLengths[node.JointIndex]) / 2;
     }
     else
     {
         _boneLengths.Add(node.JointIndex, length);
     }
 }
示例#20
0
 public JointNode(JointType index, JointNode parent, Axis axis, bool isKinectJoint = true) :
     this(index.ToString(), index, parent, axis, NodeTypeEnum.JOINT, true)
 {
 }
示例#21
0
 /// <summary>
 /// get a bone's original offset based on its own offset and the symmetric node's offset if it has
 /// </summary>
 /// <param name="node"></param>
 /// <returns></returns>
 private double getJointStandardInitialOffset(JointNode node)
 {
     double offsetLength = getMaxAxisFromPoint(_initialOffsets[node.Name]);
     if (getSymmetricNode(node) == node)
         return offsetLength;
     else
     {
         double symmetricNodeOffsetLength = getMaxAxisFromPoint(_initialOffsets[getSymmetricNode(node).Name]);
         return (offsetLength + symmetricNodeOffsetLength) / 2;
     }
 }
示例#22
0
 public bool AddChild(JointNode node)
 {
     return(Children.Add(node) >= 0);
 }
示例#23
0
 /// <summary>
 /// one joint's rotation is actually stored in its parent joint, so for a given joint, we should get its child joint's rotation
 /// </summary>
 /// <param name="joint"></param>
 /// <returns></returns>
 private JointType getRotationJoint(JointNode node)
 {
     switch (node.Name)
     {
         case "ShoulderLeft":
             return JointType.ElbowLeft;
         case "ElbowLeft":
             return JointType.WristLeft;
         case "WristLeft":
             return JointType.HandLeft;
         case "ShoulderRight":
             return JointType.ElbowRight;
         case "ElbowRight":
             return JointType.WristRight;
         case "WristRight":
             return JointType.HandRight;
         case "HipLeft":
             return JointType.KneeLeft;
         case "KneeLeft":
             return JointType.AnkleLeft;
         case "AnkleLeft":
             return JointType.FootLeft;
         case "HipRight":
             return JointType.KneeRight;
         case "KneeRight":
             return JointType.AnkleRight;
         case "AnkleRight":
             return JointType.FootRight;
         default:
         //case "HipCenter":
         //case "HipCenter2":
         //case "Spine":
         //case "ShoulderCenter":
         //case "Neck":
         //case "Head":
         //case "CollarLeft":
         //case "CollarRight":
             return node.JointIndex;
     }
 }
 private void AddBVHBone_Debug(JointNode node1, JointNode node2)
 {
     addLineToWindow(node1.Offset.X, node1.Offset.Y,
                     node2.Offset.X, node2.Offset.Y,
                     BTUSH_BONE_DEBUG, DOUBLE_THICKNESS_BONE_DEBUG);
 }
示例#25
0
        /// <summary>
        /// initialize human skeleton structure
        /// </summary>
        private void initializeSkeletonStructure()
        {
            JointNodes = new Dictionary<string, JointNode>();

            // root
            HipCenter = new JointNode(JointType.HipCenter.ToString(), JointType.HipCenter, null, Axis.None, NodeTypeEnum.ROOT, true);
            JointNodes.Add(HipCenter.Name, HipCenter);

            // hip, spine, shouderCenter, neck, head
            JointNode hipCenter2 = new JointNode("HipCenter2", JointType.HipCenter, HipCenter, Axis.Y, NodeTypeEnum.JOINT, false);
            JointNodes.Add(hipCenter2.Name, hipCenter2);
            JointNode spine = new JointNode(JointType.Spine, hipCenter2, Axis.Y);
            JointNodes.Add(spine.Name, spine);
            JointNode shoulderCenter = new JointNode(JointType.ShoulderCenter, spine, Axis.Y);
            JointNodes.Add(shoulderCenter.Name, shoulderCenter);
            JointNode neck = new JointNode("Neck", JointType.Head, shoulderCenter, Axis.Y, NodeTypeEnum.JOINT, false);
            JointNodes.Add(neck.Name, neck);
            JointNode head = new JointNode(JointType.Head, neck, Axis.Y);
            JointNodes.Add(head.Name, head);
            JointNode headEnd = new JointNode("HeadEnd", JointType.Head, head, Axis.None, NodeTypeEnum.END, false);
            JointNodes.Add(headEnd.Name, headEnd);

            // left arm
            JointNode collarLeft = new JointNode("CollarLeft", JointType.ShoulderLeft, shoulderCenter, Axis.X, NodeTypeEnum.JOINT, false);
            JointNodes.Add(collarLeft.Name, collarLeft);
            JointNode shoulderLeft = new JointNode(JointType.ShoulderLeft, collarLeft, Axis.X);
            JointNodes.Add(shoulderLeft.Name, shoulderLeft);
            JointNode elbowLeft = new JointNode(JointType.ElbowLeft, shoulderLeft, Axis.X);
            JointNodes.Add(elbowLeft.Name, elbowLeft);
            JointNode wristLeft = new JointNode(JointType.WristLeft, elbowLeft, Axis.X);
            JointNodes.Add(wristLeft.Name, wristLeft);
            JointNode handLeft = new JointNode(JointType.HandLeft.ToString(), JointType.HandLeft, wristLeft, Axis.X, NodeTypeEnum.END, true);
            JointNodes.Add(handLeft.Name, handLeft);

            // right arm
            JointNode collarRight = new JointNode("CollarRight", JointType.ShoulderRight, shoulderCenter, Axis.nX, NodeTypeEnum.JOINT, false);
            JointNodes.Add(collarRight.Name, collarRight);
            JointNode shoulderRight = new JointNode(JointType.ShoulderRight, collarRight, Axis.nX);
            JointNodes.Add(shoulderRight.Name, shoulderRight);
            JointNode elbowRight = new JointNode(JointType.ElbowRight, shoulderRight, Axis.nX);
            JointNodes.Add(elbowRight.Name, elbowRight);
            JointNode wristRight = new JointNode(JointType.WristRight, elbowRight, Axis.nX);
            JointNodes.Add(wristRight.Name, wristRight);
            JointNode handRight = new JointNode(JointType.HandRight.ToString(), JointType.HandRight, wristRight, Axis.nX, NodeTypeEnum.END, true);
            JointNodes.Add(handRight.Name, handRight);

            // left lower part
            JointNode hipLeft = new JointNode(JointType.HipLeft, HipCenter, Axis.X);
            JointNodes.Add(hipLeft.Name, hipLeft);
            JointNode KneeLeft = new JointNode(JointType.KneeLeft, hipLeft, Axis.nY);
            JointNodes.Add(KneeLeft.Name, KneeLeft);
            JointNode ankleLeft = new JointNode(JointType.AnkleLeft, KneeLeft, Axis.nY);
            JointNodes.Add(ankleLeft.Name, ankleLeft);
            JointNode footLeft = new JointNode(JointType.FootLeft.ToString(), JointType.FootLeft, ankleLeft, Axis.Z, NodeTypeEnum.END, true);
            JointNodes.Add(footLeft.Name, footLeft);

            // right lower part
            JointNode hipRight = new JointNode(JointType.HipRight, HipCenter, Axis.nX);
            JointNodes.Add(hipRight.Name, hipRight);
            JointNode kneeRight = new JointNode(JointType.KneeRight, hipRight, Axis.nY);
            JointNodes.Add(kneeRight.Name, kneeRight);
            JointNode ankleRight = new JointNode(JointType.AnkleRight, kneeRight, Axis.nY);
            JointNodes.Add(ankleRight.Name, ankleRight);
            JointNode footRight = new JointNode(JointType.FootRight.ToString(), JointType.FootRight, ankleRight, Axis.Z, NodeTypeEnum.END, true);
            JointNodes.Add(footRight.Name, footRight);
        }
示例#26
0
 public JointNode(JointType index, JointNode parent, Axis axis, bool isKinectJoint = true)
     : this(index.ToString(), index, parent, axis, NodeTypeEnum.JOINT, true)
 {
 }