예제 #1
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);
            }
        }
예제 #2
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);
            }
        }